Style a heading and a paragraph.
What to build
A style element with two rules.
Requirements
- Every
h1has the colourdarkblue. - Every
phas a font size of18px.
Constraints
Use a style element in the head. Do not use the style attribute.
Example
h2 { color: red; } turns every h2 red.
Why it works
The selector chooses the elements, and each declaration changes one feature of them.
Hints
Hint 1
A style element goes inside head.
Hint 2
Each rule needs a selector and curly braces.
Solution
Show one correct solution (try it yourself first)
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Bakery</title>
<style>
h1 { color: darkblue; }
p { font-size: 18px; }
</style>
</head>
<body>
<h1>Mina's Bakery</h1>
<p>Fresh bread every morning.</p>
</body>
</html>