Chapter 9. CSS-DOM

What this chapter covers:

  • Introducing the style property

  • How to retrieve style information

  • How to change styles

In this chapter, the presentation layer and the behavior layer will meet head-on. You'll see how the DOM can be used to get and set styles by reading and writing CSS.

Three sheets to the Web

Content on the Web can be wrapped up in three successive layers that web browsers can read:

  • Structure

  • Presentation

  • Behavior


First and foremost, the structural layer is created with a markup language, such as HTML or XHTML. The tags, or words contained in angle brackets, describe the semantic meaning of content. For example, the <p> tag conveys the information, "This content is a paragraph." But the tag doesn't include any information ...

Get DOM Scripting: Web Design with JavaScript and the Document Object Model, Second 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.