-
DIV positioning
could anyone point me in the right direction, Im trying to create a website with no tables, so am using divs and CSS. I'd like a 760 px div in the center for small browser windows, with a a div on the right and one on the left that take up the rest of the space equally. Does anyone know how to do this?
-
Re: DIV positioning
-
Re: DIV positioning
I don't like W3C documentation. Always way too complicated for what it actually is.
So I'll save you 2 hours of misery:
First you need a div-tag and give it a name. Imho there's only one div tag needed. (If you do want multiple div tags then post a reply, I'll see what I can do) :)
Next make a STYLE CSS block and put a reference to that name. There you need to specify the width and ofcourse all kind of other stuff like font and colour, etc...
After that you could set the background colour by specifying the BODY element in the Style block.
And if you want the whole thing to be centered I would just wrap some CENTER tags around the div tag.
HTML Code:
<style>
.test{
width:720px;
background-color:#FF0000;
}
BODY{
background-color:#FF4444;
}
</style>
<BODY>
<CENTER>
<DIV class="test">
Content and text goes here
</DIV>
</CENTER>
</BODY>
Another (bad imho) way to do it:
HTML Code:
.test{
position: absolute;
left: ...;
width: ...;
z-index: ...;
}
That would make a margin at the left and right but wouldn't really help people with small resolution. Cause also for them it would leave a border. So you would end up writing some javascript around it I guess?
Same goes for:
HTML Code:
.test{
margin-left: ...;
margin-right: ...;
}