Advertisement

Styling DOM Elements

  • Adam Freeman

Abstract

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 work in all of the mainstream browsers.

Keywords

Unit Type Media Attribute MediaList Object Element Table External File 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Copyright information

© Adam Freeman 2011

Authors and Affiliations

  • Adam Freeman

There are no affiliations available

Personalised recommendations