O'Reilly logo

Sams Teach Yourself CSS in 10 Minutes by Russ Weakley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 2. Using CSS Rules

In this lesson, you will learn the syntax and rules of the Cascading Style Sheet (CSS) language. You will learn the components of CSS rules, including selectors, declarations, properties, and values. You will learn how to style a series of simple HTML elements. You will also learn how to use shorthand properties.

Setting Up the HTML Code

The HTML code for this lesson will be comprised of three elements—<h1>, <h2>, and <p>, as shown in Listing 2.1.

Example 2.1. HTML Code Containing the Markup for Lesson 2

<h1>
    Level 1 heading
</h1>
<h2>
    Level 2 heading
</h2>
<p>
    Lorem ipsum dolor sit amet, consectetuer...
</p>

Creating a Rule Set

A rule, or rule set, is a statement that tells browsers how to render particular elements on an ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required