Easy CSS Problem.

Soldato
Joined
26 Feb 2004
Posts
4,800
Location
Hampshire, England.
Hey guys,

I think this is going to be an easy one for all you .css gurus here :p

I want my top and bottom div’s to completely stretch from left to right. I thought this was achieved by setting their width attributes to 100%

I’ve sort of remedied the issue by setting the margins as negative values, e.g. -20px.

Here’s what I’ve got atm.



My .css:

#top {
position: fixed; top: 0;
width: 100%;
height: 20%;
background-color: #000000;
padding: 0px;

}

#bottom {
position: fixed; bottom: 0;
width: 100%;
height: 20%;
background-color: #FF0000;
padding: 0px;

}


I want the colours to span right to the side (Left).

Cheers,

SW.
 
general good practice for CSS is to reset browser-based anomalies by default. you can take it as far as you want, but I tend to globally reset margin and padding, as well as resetting font sizes for Hs and removing list images from ul and ols

global margin/padding removal

Code:
* { margin: 0; padding: 0; }
 
Back
Top Bottom