PDA

View Full Version : Divs? [Lolatme] [+Rep]



myke
28-10-2006, 02:58 PM
I have completely forgotten how to use these, haven't used them in such a long time, can anyone link me to a beginner's tutorial, + Rep if you can :eusa_wall

Jackboy
28-10-2006, 03:01 PM
go to www.w3schools.com (http://www.w3schools.com)

Its legendary ;P

myke
28-10-2006, 03:05 PM
Ooo, I remember now, that's pretty simple stuff :>!

I've been told you can also place things like images on a page in places that you can't normally? o_O

DuHast
28-10-2006, 03:10 PM
Heres my uber skill explaining in a few minutes.

Basically use them to add style to a certain section or all of your layout for example:


<div id="header"></div>
<div class="content">

You have defined an ID and a Class, you use an ID when you want that part to be used just once and a class can be used as many times as you want, so use it for paragraghs and H2 etc.

Now we need to add style so use the # and . for ID and Class.


#header {
width: 100px;
height: 150px;
}

.content {
background-color: black;
width: 100px;
color: white;
}

Although you wouldn't use a class for content I am using it as an example. Hope this helps, i'm not much of an explainer, but if you read W3.org and W3schools.com you will have a better understanding.

You could use a Position:absolute to place images but it can have nasty incompatibility issues if not done correctly and I personally don't use it.

Heinous
29-10-2006, 06:02 AM
Heres my uber skill explaining in a few minutes.

Basically use them to add style to a certain section or all of your layout for example:


<div id="header"></div>
<div class="content">You have defined an ID and a Class, you use an ID when you want that part to be used just once and a class can be used as many times as you want, so use it for paragraghs and H2 etc.

Now we need to add style so use the # and . for ID and Class.


#header {
width: 100px;
height: 150px;
}

.content {
background-color: black;
width: 100px;
color: white;
}Although you wouldn't use a class for content I am using it as an example. Hope this helps, i'm not much of an explainer, but if you read W3.org and W3schools.com you will have a better understanding.

You could use a Position:absolute to place images but it can have nasty incompatibility issues if not done correctly and I personally don't use it.
But that's using CSS and HTML. For just HTML it should be..

<div style="width:100px; height:150px;"></div>
<div style="background-color:#000000; width:100px; color: #FFFFFF;"></div>

Of course, that's using CSS names for all the stuff, but you don't need an external file. (Or any style info in the header)

And a word of advice, always have a background-color with color and vice-versa, to keep the CSS valid. If you don't want a new color (bg or text), just use color: inherit; :)

Want to hide these adverts? Register an account for free!