Web Design with HTML and CSS

(National Geographic (Little) Kids) #1

66


The role of CSS


Web Design with HTML and CSS Digital Classroom

The role of CSS


Cascading Style Sheets (CSS) use a separate language from HTML. CSS allows you to apply
consistent styling of elements across all pages on your site, so that all headings, lists, and
paragraphs look and act the same on every page of a site.

How we refer to CSS syntax in this book


Before you begin to work with CSS, we need to explain how we will refer to the various
parts of CSS syntax throughout this book. This is not as easy as it sounds because there is a gap
between the offi cial specifi cation of the CSS language and the way designers often refer to CSS
in the “real world.” Nevertheless, here are the fundamentals: all the following code is what we
refer to as a rule in CSS:
h1 {
color:blue;
margin-top:1em;
}
There are various components to this rule, as follows:

K^
FRORUEOXH
PDUJLQWRSHP¦
`

A

C

B

D

A. Selector. B. Declaration. C. Property. D.Value.

We will refer to each of the various components from time to time throughout the book, so if
we ask you to change the value “blue” to “red” you should know what to do. Or if we ask you
to locate and change the h1 selector to a h2 selector, it should make sense.
On a day-to-day basis, most designers aren’t always so specifi c however. For example the rule
above might be referred to as a “style,” “style rule,” “the h1 rule,” or “the CSS rule for h1.” Also,
as you can see above, the offi cial name for the pair of the property and the value is called a
declaration. Again, in everyday use, the use of the term “declaration” is not common and most
designers will use the term property or properties interchangeably.
Free download pdf