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.
While you’ve already learned the most common selectors, here are a few more you might want to know about...
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
Attribute selectors are exactly what they sound ...