HI Guys !!!
Can anybody tell me how to use first-child, last-child and nth-child classes ??
Thanks in advance
HI Guys !!!
Can anybody tell me how to use first-child, last-child and nth-child classes ??
Thanks in advance
To use First child classes::
Here first child will be colored red.
To use Last child classes::Code:li:first-child { color:red; }
Here last child will be colored red.
To use nth child classes::Code:li:last-child { color:red; }
Here all multiples of 2(like 2,4,6,8...) will be colored red.
Here mentioned child(like here 5th child) will be colored red.Code:li:nth-child(2n){ color:red; }
Code:li:nth-child(5){ color:red; }
Last edited by Sherin; 05-14-2019 at 02:31 AM.
|
Bookmarks