|
Simple CSS Constructions
Note: On a code page spaces do not matter and characters are everything.
h1 stands for heading one, h2 heading two, p stands for paragraph. Together they are called selectors and for CSS they are placed as follows:
h1 { font size and whatever }
h2 { font size and whatever }
p { font size and whatever }
In your document between <body> and </body> your write:
<h1> My Heading </h1>
<h2> A Subheading </h2>
<p> Blah blah </p>
You can invent your own selectors. One selector I've invented is for a second style of paragraph, intented differently or whatever from the first style of paragraph. In CSS it looks something like:
.p2 { font size and whatever }
Between <body> and </body> I write:
<p class="p2"> Blah blah </p>
Such a selector is called a class selector. Class selectors can be repeated in a document. I can put a lot of p2 paragraphs in the document. Class selectors are precended by a dot, as you see three lines up.
The other kind of selector is a called an ID selector. In CSS it is preceded by #, and in the body of the document it is used just once. Two ID selectors that I use are:
#leftcolumn { font size and whatever }
#rightcolumn {font size and whatever }
In the body:
<div id="leftcolumn"> blah blah blah </div>
<div id="rightcolumn"> blah blah blah </div>
Body Divisions
Divisions -- an important point: you can divide the body of your document into numerous divisions, or a division within a division, but every division that begins needs an ending: </div>. Computers keep track of the divisions well enough. If you fail to mark the end of any division you are creating, it will throw off the structure of the body of your document.
Copyright © 2008 Frank E. Smitha. All rights reserved.