How to centre site when forced to use float:left attribute? [SOLVED?]
Posted: Sun Mar 22, 2009 8:04 pm
HI,
I have created my site using only DIV tags and css.
Can anyone tell me how to get a white background to this layout:
==========================
This tag contains all the elements of my site and I have set it's background to white #FFFFFF
Banner elements here. again background set to white
Top navigation
THe next three divs are in a row, inline:
Left hand sub-level naivigation
Main page content
This contains ny news items and sit on the RHS, there is also an option for a LHS news box
Copyright information
=========================
Styles are:
#container
{
float: none;
position: relative;
background-color: #ffffff;
width: 900px;
margin: 0px auto;
display: block;
}
#banner
{
padding:0px;
margin: 0 0 20px 0; /* margin-top, margin-right, margin-bottom, margin-left */
/* background:#fff url(images/banner.jpg) no-repeat right top; */
}
#topNav
{
position: relative;
float:right;
text-align: right;
color: #663399;
margin: 0px 15px 5px 0px; /* margin-top, margin-right, margin-bottom, margin-left */
background-color: #FFFFFF;
width: 98%;
height: 40px;
display: inline;
}
#leftSide
{/* left column can contain either the side menu and news or both*/
position: relative;
float:left;
left: 0px;
margin-left: 15px;
width: 180px;
padding: 0;
overflow: hidden;
}
#content
{/* right column */
float: left;
position: relative;
left: 0px;
margin-left: 20px;
width: 420px;
background: #FFF;
overflow: hidden;
padding-bottom:: 30px;
}
#newsRight
{/* right news column */
float: right;
margin-right: 40px; /* margin-top, margin-right, margin-bottom, margin-left */
margin-top: 20px;
width: 170px;
overflow: hidden;
font-size: 9px;
font-weight: normal;
color: #663399;
background-color: #CC99FF ;
padding: 5px 5px 5px 10px; /* padding-top, padding-right, padding-bottom, padding-left */
}
#copyright
{
display: block;
text-align: right;
font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
background-color: #FFFFFF;
padding: 5px;
font-size:9pt;
color:#aaa;
line-height:120%;
word-spacing:1px;
border-top:1px solid #ddd;
width: 95%;
position:relative;
float: left;
}
It seems the does not stretch down to enclosed any of the divs that have a float atrribute.
My site can be seen here:
www.christchurchnorthfinchley.co.uk
Thanks
I have created my site using only DIV tags and css.
Can anyone tell me how to get a white background to this layout:
==========================
This tag contains all the elements of my site and I have set it's background to white #FFFFFF
Banner elements here. again background set to white
Top navigation
THe next three divs are in a row, inline:
Left hand sub-level naivigation
Main page content
This contains ny news items and sit on the RHS, there is also an option for a LHS news box
Copyright information
=========================
Styles are:
#container
{
float: none;
position: relative;
background-color: #ffffff;
width: 900px;
margin: 0px auto;
display: block;
}
#banner
{
padding:0px;
margin: 0 0 20px 0; /* margin-top, margin-right, margin-bottom, margin-left */
/* background:#fff url(images/banner.jpg) no-repeat right top; */
}
#topNav
{
position: relative;
float:right;
text-align: right;
color: #663399;
margin: 0px 15px 5px 0px; /* margin-top, margin-right, margin-bottom, margin-left */
background-color: #FFFFFF;
width: 98%;
height: 40px;
display: inline;
}
#leftSide
{/* left column can contain either the side menu and news or both*/
position: relative;
float:left;
left: 0px;
margin-left: 15px;
width: 180px;
padding: 0;
overflow: hidden;
}
#content
{/* right column */
float: left;
position: relative;
left: 0px;
margin-left: 20px;
width: 420px;
background: #FFF;
overflow: hidden;
padding-bottom:: 30px;
}
#newsRight
{/* right news column */
float: right;
margin-right: 40px; /* margin-top, margin-right, margin-bottom, margin-left */
margin-top: 20px;
width: 170px;
overflow: hidden;
font-size: 9px;
font-weight: normal;
color: #663399;
background-color: #CC99FF ;
padding: 5px 5px 5px 10px; /* padding-top, padding-right, padding-bottom, padding-left */
}
#copyright
{
display: block;
text-align: right;
font-family: "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
background-color: #FFFFFF;
padding: 5px;
font-size:9pt;
color:#aaa;
line-height:120%;
word-spacing:1px;
border-top:1px solid #ddd;
width: 95%;
position:relative;
float: left;
}
It seems the does not stretch down to enclosed any of the divs that have a float atrribute.
My site can be seen here:
www.christchurchnorthfinchley.co.uk
Thanks