/    Sign up×
Community /Pin to ProfileBookmark

lower a background image by 20px?

Hi, i have a background image on my body tag, and if i put margin on my body tag, it lowers all the content by 20px, but not the background image, how can i move this down my 20 px also, thanks.

to post a comment
CSS

5 Comments(s)

Copy linkTweet thisAlerts:
@joncotesFeb 09.2006 — Just edit the image in photoshop by setting the canvas size 20px taller. Make sure it adds the excess to the top.
Copy linkTweet thisAlerts:
@decibelauthorFeb 09.2006 — ya man, i already knew that, which is what i had to do, however this solution poses 2 problems... i just increased the image size, which is bad for loading, and CSS SHOULD be able to handle this...
Copy linkTweet thisAlerts:
@johnevaFeb 09.2006 — [CODE]
body {
background-image: url(image.jpg);
background-position: 0px 20px;
}
[/CODE]
Copy linkTweet thisAlerts:
@mrmazurFeb 09.2006 — Give this a shot, it should work:

[CODE]
<html>
<head>
<style>
body {
margin: 0px;
padding: 0px;
background-image: url(image.gif);
}

#topPad {
padding: 5px;
background-color: #FFFFFF;
}

#mainContent {
color: #FFFFFF
}
</style>
</head>

<body>
<div id="topPad">&nbsp;</div>

<div id="mainContent">
Content Here
</div>
</body>
</html>
[/CODE]
Copy linkTweet thisAlerts:
@ray326Feb 09.2006 — i just increased the image size, which is bad for loading,[/QUOTE]
A 20px solid color strip should add almost zero to the image size. How big were the two images?
and CSS SHOULD be able to handle this...[/QUOTE]
It will but you have to do it with the [B]background[/B], not its container.
×

Success!

Help @decibel spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...