The role of CSS
67
Lesson 4, Fundamentals of HTML, XHMTL, and CSS
4
Styling a heading
To get a sense of how CSS works, you’ll create a simple CSS rule that changes the style of a
heading in your page. In your index.html page, you already have the content “SmoothieWorld”
nested inside an tag. Perhaps one of the best ways to begin thinking about how CSS
67
Lesson 4, Fundamentals of HTML, XHMTL, and CSS
4
Styling a heading
To get a sense of how CSS works, you’ll create a simple CSS rule that changes the style of a
heading in your page. In your index.html page, you already have the content “SmoothieWorld”
nested inside an
tag. Perhaps one of the best ways to begin thinking about how CSS
works is to consider how the default style of this heading is rendered in the browser.
1 Examine the heading of the fi le you previewed in the last step of the previous exercise. The
style and formatting instructions are being provided by the browser. The size, color, and font
are provided by the browser because exact formatting instructions are not specifi ed. The
browser only knows that this is a headline. You will redefi ne this style with a CSS rule.
2 In your code, locate the tag on line 5, click once at the end of the line,
following the closing tag, then press return to add a new line of code. Type the following:
, This is a style element which you will
use to place your rule for the style of the element.
The
following the closing tag, then press return to add a new line of code. Type the following:
, This is a style element which you will
use to place your rule for the style of the
