Wednesday, April 22, 2015

first-of-type and last-of-type

The :first-of-type selector matches every element that is the first child, of a particular type, of its parent.

p:first-of-type {
background: #ff0000;
}

Specifies the background color for the first <p> element of its parent.

The :last-of-type selector matches every element that is the last child, of a particular type, of its parent.

p:last-of-type {
background: #ff0000;
}

Specifies the background color for the last <p> element of its parent.

Technorati Tags:

No comments:

Post a Comment