Skip to Main Content
Head First HTML and CSS, 2nd Edition
book

Head First HTML and CSS, 2nd Edition

by Elisabeth Robson, Eric Freeman
August 2012
Beginner content levelBeginner
768 pages
18h 20m
English
O'Reilly Media, Inc.
Content preview from Head First HTML and CSS, 2nd Edition

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

HTML & CSS: Design and Build Websites

HTML & CSS: Design and Build Websites

Jon Duckett

Publisher Resources

ISBN: 9781449324469Errata PageSupplemental Content