Cascading Style Sheets (CSS) controls how web-page elements look. HTML supplies structure and content; CSS supplies presentation, including color, typography, and layout. CSS is declarative: you specify the appearance you want, and the browser works out how to render it. section 1.0 section 1.1.1 section 1.1.2
CSS3 names an earlier generation of specifications, not a single feature set you must enable. CSS features are developed in separate modules rather than bundled into large releases. section 1.1.1 section 1.8
To style a page, connect CSS to HTML, then write rules:
- Apply CSS inline, in a <style> element in the HTML head, or through an external stylesheet. An external file keeps presentation separate from HTML. section 1.3 section 1.3.2 section 1.8
- A rule pairs a selector with declarations. In `h1, h2 { color: crimson; }`, the selectors target two heading types, and the declaration gives them a color. section 1.3.2
- If a declaration is invalid, the browser ignores it while still applying valid declarations in the rule. Browser defaults and user styles can also affect the result. section 1.3.2 section 1.8
Start with an article
Create an HTML article with headings, paragraphs, a list, and images, then link `styles.css` in the document head. Add rules incrementally: first select the elements you want to change, then choose properties and values. This produces a simple single-column page without mixing its presentation into its content. section 1.2 section 1.0
The same CSS can adapt a layout to different screens. Media queries can change styles by viewport size or capability; for a checkout cart, a practical approach is to stack content on narrow screens and add wider-screen rules afterward. CSS has limits, though: operating-system styling restricts how far some native form controls can be changed without replacing them. section 5.1 section 8.0 section 10.4












