untitled

(John Hannent) #1
element, they’ve called it a keyword. Some language elements are clearly func-
tions or operators and so on. Others are hard to categorize. In effect, keyword
has no real meaning — it’s just the grab bag where unclassifiable concepts are
tossed. For these kinds of terms, I prefer the word command. So I’m calling
!Importanta command. And why not? Everyone has a different favorite
terminology.

To build a CSS, open Notepad and type the following style definitions:

p
{
color: blue;
text-align: center;
font-family: arial
!important;
}

Save this CSS as MyFirst.css.

Open the MyFirst.htm file in Notepad. You see something like the following
code at the very top of the .htm file. Insert a link to the .css file as shown here
in boldface:

<html xmlns:o=”urn:schemas-microsoft-com:office:office”
xmlns:w=”urn:schemas-microsoft-com:office:word”
xmlns=”http://www.w3.org/TR/REC-html40”>
<head>
<meta http-equiv=Content-Type content=”text/html;
charset=windows-1252”>
<meta name=ProgId content=Word.Document>
<meta name=Generator content=”Microsoft Word 11”>
<meta name=Originator content=”Microsoft Word 11”>
<link rel=File-List
href=”Building%20your%20First%20Style%20Sheet_files/filelist.
xml”>
<link type=”text/css” rel=”stylesheet” href=”MyFirst.css”>
<title>Building your First Style Sheet</title>

Where in an .htm file you place your various elements is often not critical —
although of course you want some things in the header and some in the body.
Also, the order in which items are displayed or script code is executed can
be affected by their order in the code. However, putting similar elements
together if possible is usually best. For that reason, put your new link to the
.css file just below Microsoft’s link to its own .xml file.

The importance of !Important ...........................................................

Now save the MyFirst.htm file. Test the style sheet by double-clicking
MyFirst.htm to load it into Internet Explorer. You should see the results of

60 Part I: The ABCs of CSS

Free download pdf