CSS Tips | :first-child
NOV
16
Nov 16, 2009
by
0
Using the CSS pseudo-class :first-child allows you to style any thing that is the "first child" of another element. One case that this may be helpful is when you want a different style for the first li element in your list. i.e. additional margin, color, etc. This would be done like this.
ul li:first-child {
margin-top: 20px;
color: #000000;
}
Support for this pseudo-class is limited to Firefox, Safari and versions of Internet Explored later than IE6.