We can style specific rows of a table
using pseudo classes like :first-child
,
:last-child
and so on,
along with the tr
selector:
Try changing the above
selector to tr:first-child
.
Apart from first and last child,
we can select a specific child,
or a row, using the :nth-child
pseudo class:
Try changing the above selector to tr:nth-child(1)
or tr:nth-child(3)
.
The :nth-child
class can also be used to select odd
and even
rows:
Try changing even
to odd
in the above example.