bg-red-500 and bg-blue-500 applied to the same element), how does the browser decide which style to apply?In CSS, when multiple rules apply to the same property, the one that appears last in the stylesheet or inline style wins. Tailwind generates utility classes as normal CSS classes, so when multiple conflicting classes are applied, the browser uses the last one listed in the class attribute.
<div class="bg-red-500 bg-blue-500">Hello</div>, what background color will the element have when rendered in the browser?The browser applies CSS rules in order. Since bg-blue-500 comes after bg-red-500 in the class list, the blue background overrides the red.
text-green-600 from Tailwind. You want to override its text color to red using your own CSS. Which CSS selector will correctly override the Tailwind style?Tailwind utility classes have specific CSS rules. To override them without changing HTML, you can use the same class selector with !important to force your style to apply.
<div class="flex flex-col flex-row">Content</div>. What will be the layout direction of the flex container?Both flex-col and flex-row set the flex-direction property. Since flex-row is last, it overrides flex-col, so children arrange in a row.
focus:ring-2 focus:ring-blue-500 focus:ring-offset-4 focus:ring-offset-red-300. Which focus ring color and offset will the button show when focused?The focus:ring-2 sets ring thickness, focus:ring-blue-500 sets ring color, focus:ring-offset-4 sets offset size, and focus:ring-offset-red-300 sets offset color. These classes complement each other, so the button shows a blue ring with a red offset.