structural selectors

Explanation: These CSS selectors (structural) allow you to style elements which match a given condition. Keep in mind that specificity may have an effect on the declarations. However, one can significantly reduce the number of classes one typically codes by employing these.

Some of the selectors on can  employ include: : root (for the <html> element itself), : first-child, : last-child, : first-of-type, : last-of-type, : only-child, and : only-of-type.

Example CSS code:

Note that wildcards (the asterisk *) can be used to denote all elements in the document.

/* CSS-3 specific styles*/
*:first-child {

p:first-child {

Examine the linked document below and identify why certain rules apply.

Example page (view the source code): (should work in most modern browsers).


  • tutorials

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.