Chapter 4Styling Content and Interfaces

For far too long, we developers have hacked around CSS to get the effects we need in our code. We’ve used JavaScript or server-side code to stripe table rows or put focus and blur effects on our forms. We’ve had to litter our tags with additional class attributes just so we could identify which of our fifty form inputs we want to style.

But no more! CSS3 has amazing selectors that make some of this work trivial. A selector is a pattern that you use to help you find elements in the HTML document so you can apply styles to those elements. We’ll use these new selectors to style a table. Then we’ll take a look at how we can use some other CSS3 features to improve our site’s print style sheets, and we’ll split ...

Get HTML5 and CSS3, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.