/    Sign up×
Community /Pin to ProfileBookmark

centering background

I don’t know where is this goin’ so I’ll post it here.

I need to place my background picture in center of my site.
Is there any code or script to do this ??
It needs to repeat verticaly and not horizontaly (like default)

Thanks, Buky

to post a comment
Full-stack Developer

1 Comments(s)

Copy linkTweet thisAlerts:
@Robert_WellockFeb 11.2003 — If you wanted the background-image to be centre positioned on a page; prevent the image repeating, or only have it repeat either vertically or horizontally only, that could be accomplished fairly easily using Cascading Style Sheets (CSS).

[CODE]
<style type="text/css">
<!--
body {
background-image : url("http://www.yoursite.com/yourimage.jpg");
background-repeat : repeat-y;
background-position : 50% 50%;
}
-->
</style>
[/code]


For example if the code above was placed between the <head>....</head> it would set a y-repeating background image in the centre of the browser window as your background, obviously you'd have to supply the correct "url" value to point to your own image.
×

Success!

Help @buky 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 4.29,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...