You are previewing Eloquent JavaScript.

Eloquent JavaScript

Cover of Eloquent JavaScript by Marijn Haverbeke Published by No Starch Press
O'Reilly logo

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 ...

The best content for your career. Discover unlimited learning on demand for around $1/day.