Page is a not externally linkable
- Code, Content, and Presentation
-- CSS
---- Defining Classes in CSS


papabaer - 7:19 pm on Apr 17, 2002 (gmt 0)


A class... can be applied anywhere. A CSS #id is a unique, one of a kind, don't even THINK about usin' me anywhere else (on THIS page!), "style statement."

The #id & CSS can be used to create predefined "templates" for use throughout your site.

For instance:

#header{
position:absolute;
top:0;
left:0;
width:468px;
height:60px;
}

can be used to define a div for use on EACH page desired...

If you really want to get efficient (at NN4's loss) try this for "file conservation":

#header{
position:absolute;
top:0;
left:0;
width:468px;
height:60px;
background-image:url (images/my-banner-logo.gif) no-repeat;
}

Then...
<body>
<div id="header></div>
</body>

Try using THAT on 100plus pages and eliminating <div><img src="images/my-banner-logo.gif" width="468" height="60" alt="my universal banner that I stick at the top of every bloomin' page!" /></div>

Make that puppy give ya all it's got! ;)

You CAN define as a class also:

.header{
position:absolute;
top:0;
left:0;
width:468px;
height:60px;
background-image:url (images/my-banner-logo.gif) no-repeat;
}

It's just that using a #id has the advantage of being "unique" allowing for additional "scripting" (javascript/dhtml) and "construction-clarafication" i.e., once you've used it on a page... you can move on to new territory! :)

(edited by: papabaer at 8:52 pm (utc) on April 17, 2002)


Thread source:: http://www.webmasterworld.com/css/149.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com