Relative Content

Tag Archive for htmlcssreactjsfrontendtailwind-css

Why do children of tailwind grid divs inherit their siblings’ classes, such as padding and margin?

<div class=”grid grid-cols-3 gap-2″> <div class=”children-1 col-span-1 p-4 border rounded-md flex justify-center items-center bg-red-600 text-white”>Hello</div> <div class=”children-2 col-span-1 p-0 border rounded-md flex justify-center items-center”>world</div> <div class=”children-3 col-span-1 p-0 border rounded-md flex justify-center items-center”>again</div> </div> In this provided code, why do children-2 and children-3 inherit the ‘p-4’ class from children-1 but not the ‘bg-red-600’ and ‘text-white’ […]