View Single Post
Old 13-08-2007, 14:52   #1 (permalink)
Tom_E
THFC
 
Tom_E's Avatar
 
Join Date: Jan 2007
Location: Kent, England
Posts: 1,912
good css practice?

Currently putting my web site together, wanted to know if my way of horizontally centering site is ok or not. Works fine in all browsers I've tested in so far, going back to IE5.2. I'm mac based so not tested on pc yet.

Basically, I've positioned the background relatively, with auto margins left/right, with every other div absolutely positioned inside it.

Is this good practice or amateur shite?!

I know this is basic stuff to you web developers out there but I come from DTP (print) background so I'm learning XHTML/CSS as I go, this is only the third site I've put together and the first being nearly all CSS.

Example CSS below, any advice/help appreciated.

.main {
position: relative;
visibility: inherit;
z-index: 1;
margin-left: auto;
margin-right: auto;
left: 0px;
Top: 5px;
height: 960px;
width: 860px;
background-image: url(images/bg.jpg);
bottom: 10px;
}
.textbox {
position: absolute;
visibility: visible;
z-index: 2;
left: 30px;
Top: 300px;
height: 500px;
width: 500px;
margin-top: 0px;
}
#sidebox {
position:absolute;
left:591px;
top:300px;
width:241px;
height:219px;
z-index:3;
visibility: visible;
}
#urlnav {
position:absolute;
left:23px;
top:16px;
width:206px;
height:34px;
z-index:4;
}
  Reply With Quote