Style it with CSS
HTML says what things are: a heading, a paragraph, a list. CSS says how they look: colours, sizes, spacing. Keeping the two apart means you can restyle a whole site without touching its content.
CSS lives in its own file, here called style.css. Look at the <head> of index.html: this line connects the two files.
<link rel="stylesheet" href="style.css">
A CSS file is a list of rules. Each rule picks some elements and says how they should look:
h1 {
color: crimson;
font-size: 40px;
}
h1is the selector: this rule applies to every<h1>on the page.- Inside the curly braces are declarations: a property, a colon, a value, and a semicolon.
colorsets the text colour. CSS understands 140 colour names, likecrimson,navyandlinen.font-sizesets the text size.pxmeans pixels.
Open the style.css tab above the editor to write your CSS.
Your task
In style.css:
- Make the
h1text colourcrimson. - Make paragraph (
p) text18pxbig. - Give the whole page (
body) the background colourlinen, using thebackground-colorproperty.
Write all three rules in style.css, not in index.html.