Style Sheets

Closely tied to HTML and the DOM is the topic of style sheets. It is a big topic, and I will not discuss it entirely, but some understanding of style sheets is necessary for a lot of interesting JavaScript techniques.

In old-fashioned HTML, the only way to change the appearance of elements in a document was to give them extra attributes or to wrap them in extra tags, such as center to center them horizontally or font to change the font style or color. This meant that if you wanted the paragraphs or the headers in your document to look a certain way, you had to add a bunch of attributes and tags to every single one of them. This quickly adds a lot of noise to such documents and makes them annoying to write or to change.

Well, people ...

Get Eloquent JavaScript 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.