Jeremy
Jeremy

Reputation: 3809

CSS: Adjust body padding without effecting background padding?

Currently I have:

body
{
    background-image:url('images/background');
    background-color:#000;
    background-position:center; 
    background-repeat:repeat-y;
    padding-right: 75px;
    padding-left: 75px; 
} 

How can I get the background to act more like this:

body
{
    background-image:url('images/background');
    background-color:#000;
    background-position:center; 
    background-repeat:repeat-y;
} 

while still having padding for things within the body other than the background?

Basically, I want the background to not be effected by the padding settings, unlike the text, images, etc set within the body.

Upvotes: 0

Views: 3611

Answers (2)

Jawad
Jawad

Reputation: 6672

Use Box-sizing property to take care of the padding as well as margins

Upvotes: 0

Marc B
Marc B

Reputation: 360832

Rearrange things a little, so you have a new top-level container within your body, so that...

<body ...background goes here ...>
  <div id="therealbody" ... padding goes here ...> ... content here ... </div>
</body>

Upvotes: 1

Related Questions