untitled

(John Hannent) #1
But you did specify a style for the paragraph tag. So, to see this style in
action, double-click on the Web page’s filename, PStyle.htm, in Windows
Explorer. The page automatically loads into Internet Explorer and displays
the default headline style, and your modified paragraph style, as shown in
Figure 2-1.

Selectors and Such: CSS Syntax ...................................................................


The committee that developed CSS didn’t take the simple approach and use
existing HTML terminology. Instead, they invented special, new CSS words
for familiar HTML concepts such as tag and attribute. Who knows? Perhaps
they had a reason for this, but it does require you to get used to some new
jargon.

Each CSS style rule is divided into three parts: the selector,theproperty,and
the value,punctuated with braces around the property/value pair, like this:

{property: value pair}

Also, the property is separated from the value by a colon. A complete CSS
rule looks like this:

selector {property: value};

Here’s a real-world example of a CSS style. It defines the HTML paragraph <p>
element as having a value of bluefor its colorproperty:

p {color: blue};

Figure 2-1:
The
paragraph
of body
text is
right-
aligned,
blue, and
displayed
in Courier
font — just
as your
style sheet
specifies.

Chapter 2: Getting Results with CSS 33

Free download pdf