Xtazy Posted January 17, 2007 Share Posted January 17, 2007 How can I align/position a fixed background image? I want the image to be on the right side of the page, at the middle of it... Can I add an absolute position??PS: When I say a fixed image i refer at this. Link to comment Share on other sites More sharing options...
Escee Posted January 17, 2007 Share Posted January 17, 2007 body { background: url('bg.png') top middle no-repeat fixed; } The middle could be center.. but try this Link to comment Share on other sites More sharing options...
henryhenry Posted January 17, 2007 Share Posted January 17, 2007 body { background: url('bg.png') top middle no-repeat fixed; } The middle could be center.. but try this Building on that you can specify x and y position - % or px...EG:body { background: 45px 300px no-repeat fixed url('bg.png'); }or mixbody { background: center 27px no-repeat fixed url('bg.png'); }(I think you have to put the url at the back if you're grouping the properties)http://www.w3schools.com/css/pr_background.asp Link to comment Share on other sites More sharing options...
Escee Posted January 17, 2007 Share Posted January 17, 2007 [..](I think you have to put the url at the back if you're grouping the properties)http://www.w3schools.com/css/pr_background.asp Nope, doesn't matter (as you could see at the w3 site) Link to comment Share on other sites More sharing options...
jlhaslip Posted January 17, 2007 Share Posted January 17, 2007 body {background-color: #dfffdf; // set the colour for the pagebackground-image: url('images/opac_logo.gif'); // select the imagebackground-repeat: no-repeat; // no repetition of the imagebackground-attachment: fixed; // fix the image on the pagebackground-position: 50% 75%; // at this spot, play with it...} Works for me... Link to comment Share on other sites More sharing options...
Escee Posted January 17, 2007 Share Posted January 17, 2007 Yes.. but it can be made shorter (as above), so why use this much code? Link to comment Share on other sites More sharing options...
Xtazy Posted January 17, 2007 Author Share Posted January 17, 2007 Thx all guys, i figured it out...i used this: body { background: center 27px no-repeat fixed url('bg.png'); } Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now