CSS Grid lets you control layout in two directions: rows and columns. This makes it easier to build complex designs compared to older methods that only handled one direction at a time.
The class grid-cols-3 sets the grid to have 3 equal columns. The grid-rows-3 sets rows, not columns. Flexbox classes do not create grids.
<div class="grid grid-cols-4 gap-4"> <div class="col-span-2 bg-blue-300 p-4">A</div> <div class="col-span-1 bg-green-300 p-4">B</div> <div class="col-span-1 bg-red-300 p-4">C</div> </div>
The col-span-2 makes A span two columns. B and C each take one column, so they fit on the right side in the same row.
Screen readers read content in the order it appears in the HTML. Using semantic elements and keeping logical order ensures accessibility. Visual reordering with CSS can confuse screen readers if HTML order is not logical.
The col-start-2 class places or targets items starting at the second column. grid-cols-2 sets the number of columns but does not select items. nth-child(2) selects the second child, not necessarily second column. col-span-2 makes an item span two columns, not select a column.