AdBlock Detected!
Our website is made possible by displaying ads to our visitors. Please supporting us by whitelisting our website.
CSS First-Child |
The :first-child pseudo class is used to represent the first element of a series of sibling elements. The syntax for :first-child is as follows:
Example 1: Use :first-child to change the first paragraph CSS Declaration
The following HTML code,
results in the following:
In Example 1, we used :first-child to specify that the first paragraph will have a gray background. Example 2: Use :first-child to change the first list item CSS Declaration
The following HTML code,
results in the following:
In Example 2, we used :first-child to specify that the first item on the list is underlined. |
Our website is made possible by displaying ads to our visitors. Please supporting us by whitelisting our website.