HTML gives a web page its structure; CSS gives it its appearance. Think of HTML as a house’s frame and CSS as its paint and finishing touches. CSS stands for Cascading Style Sheets. A style tells the browser how to display something, while a style sheet collects those instructions for a page. section 1.4 section 1.23
A CSS style rule has three small pieces:
- A selector chooses what to style, such as every h1 heading. section 1.17
- A declaration pairs a property with a value. In font-size: 36px;, font-size is the property and 36px is the value. section 1.17
- Braces surround the declarations. A rule can hold more than one. section 7.4
Give every main heading the same size
h1 { font-size: 36px; } The browser applies this rule to every h1 heading on the page. Change 36px once, and all those headings change together. section 1.19
You can put styles directly on an HTML tag, collect rules inside a <style> element in the page’s <head>, or keep them in a separate .css file linked from the page. CSS can change text, backgrounds, spacing, and layout. When rules overlap, inheritance, the cascade, and specificity help determine which styles appear. section 7.12 section 19.22
Your turn
Try writing a rule for h2 that sets font-size to 30px. Add two second-level headings and see whether one rule changes both. section 1.19












