untitled

(John Hannent) #1
Microsoft’s embedded style does not define the color or alignment of <p>
selector, the selector that determines how paragraph elements look.
However, the font family is specified in the embedded style:

font-family:”Times New Roman”;

Notice the efficient way you can test CSS effects and modifications. Using
Notepad to hold the CSS file, you can make a change to the CSS code and
then save the file, simply refreshing the browser to see the results immedi-
ately. I mention this edit-test cycle more than once in this book because it’s
worth repeating.

The importance of being closest .......................................................

Recall the “closeness” rule in cascading styles: An embedded style takes
precedence over an external style. The only way to override the embedded
Times New Roman font is to employ the !Importantcommand.

Two other important points to remember about !Important. You must not
precede it with a semicolon and you must use it for every property (a “prop-
erty” in a CSS style has an effect on an “attribute” in the HTML code).

Omit semicolons ..................................................................................

For example, this CSS style won’t work:

font-family: arial;!Important

That’s because you must not use the semicolon between the property’s value
(arial, here) and the !Importantcommand. In order to work, your
!Importantcommand should butt right up against the value, like this:

font-family: arial!Important

Everything must be important ..........................................................

Also, the following example turns the text blue, centers it (blue and centered
don’t conflict with other styles), and increases the size to 18 points because
of the !Importantcommand — but fails to turn the font into Arial:

p
{
color: blue;
text-align: center;

62 Part I: The ABCs of CSS

Free download pdf