A Demonstration of the :first-child Pseudo-class

The style sheet of this page tells the browser to put a border around specific elements — in particular, the first child element of each element in the document body.

Since the h1 element above is the first child element of the body element, it gets a border. These paragraphs, which come later, don't.

However, some elements nested in the p elements fit the requirements: they are the first child elements of those paragraphs, so they get a border as well — as does the sole (and thus first) child element of the h1 element.

Please note that the text between start tags has no bearing on whether or not a child element is the first child element.