C H A P T E R  29

Styling DOM Elements

As you will recall from Chapter 4, you can apply styles to an element indirectly (through a stylesheet or the style element) or directly (through the style attribute). In this chapter, I show how you can use the DOM to work with the CSS styles in your document—both the ones you have explicitly defined, as well as the computed style that the browser uses to actually display elements. The specification for working with CSS in the DOM contains some deep hierarchies of object types, many of which are not implemented by the browsers. I have simplified the objects in this chapter to focus on those that the browsers use. Table 29-1 provides the summary for this chapter. Please note that not all of the examples ...

Get The Definitive Guide to HTML5 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.