O'Reilly logo

Head First HTML and CSS, 2nd Edition by Eric Freeman, Elisabeth Robson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix A. Leftovers: The Top Ten Topics (We Didn’t Cover)

image with no caption

We covered a lot of ground, and you’re almost finished with this book. We’ll miss you, but before we let you go, we wouldn’t feel right about sending you out into the world without a little more preparation. We can’t possibly fit everything you’ll need to know into this relatively short chapter. Actually, we did originally include everything you need to know about HTML and CSS (not already covered by the other chapters), by reducing the type point size to .00004. It all fit, but nobody could read it. So, we threw most of it away, and kept the best bits for this Top Ten appendix.

#1 More CSS selectors

While you’ve already learned the most common selectors, here are a few more you might want to know about...

Pseudo-elements

You know all about pseudo-classes, and pseudo-elements are similar. Pseudo-elements can be used to select parts of an element that you can’t conveniently wrap in a <div> or a <span> or select in other ways. For example, the :first-letter pseudo-element can be used to select the first letter of the text in a block element, allowing you to create effects like initial caps and drop caps. You can use the :first-line pseudo-element to select the first line of a paragraph. Here’s how you’d use both to select the first letter and line of a <p> element:

Attribute selectors

Attribute selectors are exactly what they sound ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required