PDA

View Full Version : CSS Padding



Tomm
03-04-2007, 05:59 PM
Hey,

I have a div that goes all the way along the top of the page (width: 100%). But I need to pad the div else the text is too close to the edges (padding: 1px) but if I add padding I get scroll bars.

How can I solve this?

Thanks,

Tom

YouFail
03-04-2007, 06:02 PM
Make it:

width: 98%;
padding: 1%;

Luckyrare
03-04-2007, 06:06 PM
Make it:

width: 98%;
padding: 1%;

Yuh, its simple maths Tom :rolleyes: <3

:M2K
03-04-2007, 06:06 PM
Make it:

width: 98%;
padding: 1%;

Yeah, change the padding to % and make the width smaller.

If you were to make the padding 2%, the width would be 96%, cause you'd be taking 2% off each side.

Hope this helps :)

Tomm
03-04-2007, 06:16 PM
Actually it appears to work.. apart from now in IE my text it at the top and in FF my text is at the bottom ''/

Mentor
03-04-2007, 06:20 PM
Remove the width 100&#37; from the div, divs by defult will exstend accross the entire width of the page, unless you put somthing in the way, or constrain it with a width attribute.
Remioveing that should also get rid of your padding problems, aka meaning you can supply the padding in px.
if that doesnt work, just change the overflow hidden or somthing to avoid scroll bars.

Tomm
03-04-2007, 06:21 PM
Remove the width 100% from the div, divs by defult will exstend accross the entire width of the page, unless you put somthing in the way, or constrain it with a width attribute.
Remioveing that should also get rid of your padding problems, aka meaning you can supply the padding in px.
if that doesnt work, just change the overflow hidden or somthing to avoid scroll bars.

Removing it messes up my bg ^^

Oni
03-04-2007, 06:38 PM
CSS is an ace game whats your username...sorry I couldnt resist...

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