View Full Version : div class?????


jessimo093
04-08-2006, 07:44 PM
ok, so i've been wondering...what the heck is a div class? i've been looking at various sources, and I always see this tag: <div class="head"></div> somewhere in there. And i see that it makes the text or whatever change. so what is it and how do you define the classes or whatever?

Tracey
04-08-2006, 08:20 PM
You define class in your style sheet. You can read more about style sheets here: http://www.lissaexplains.com/css.shtml and Class's here: http://www.htmlhelp.com/reference/css/style-html.html#class

Hope that helped,
Tracey

J to the izzosh
04-09-2006, 02:32 AM
There's honestly no such thing as a div class. A class is a group of styles in a style sheet (see above post for more info on CSS). When a website tells a browser to load a style sheet, the browser makes a note of all the selectors, like classes. Then, when the browser loads the page, it applies the styles accordingly. The class attribute is just a way to tell the browser that "this element should have the style of this class".

So, for example, let's say that in our style sheet we have a class named "potato" which has a red background (classes are denoted with a period in CSS):

.potato {
background-color:red;
}
And in our HTML we say that one of our <div> elements belongs to the class, "potato":
<div class="potato"></div>
That <div> element would then have a red background.