Separation of structure and presentation keeps a web page’s ingredients and appearance in different places. HTML defines the page’s structure; CSS defines its visual presentation. Keeping the layers apart makes pages easier to build, maintain, and customize. section 1.2
Think of HTML as the page’s contents and CSS as its wardrobe:
- HTML supplies the document’s organization and elements. section 1.2
- CSS supplies formatting such as colors, fonts, spacing, shadows, positioning, and rotation. section 1.2
- An external style sheet places HTML files in a structural layer and CSS files in a presentation layer. section 7.4
One style sheet, many pages
Attach the same CSS file to several HTML pages: <link href="styles.css" rel="stylesheet">. A change to the stylesheet can update every linked page, while shared headings keep a consistent appearance. The visual design moves together without rearranging the HTML. section 7.4
Figure 1.3 The example web page with a few styles applied
See the example page after a few CSS styles are applied. section 1.2
