homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderators: not2easy

CSS Forum

Resize background image to browser size?

 4:23 pm on May 29, 2012 (gmt 0)


Please can someone help me out, I am a newbie when it comes to CSS and have been trying to learn as much as possible online.

I have a background image that I am trying to make it resize when the browser window gets smaller or bigger.

I have seen the right code online but do not know how to implement it into my own code.

This is what I have at the moment.

* { margin:0; padding:0;}
body {
font-family:Arial, Helvetica, sans-serif;
padding:29px 0 33px 0;
background: url("../images/body-bg.jpg");
background-attachment: fixed;
background-repeat: no-repeat;
background-size:height 100% width 100%;

I have tried adding the code to this but I just cannot get it to work.

It would be much appraised if someone could help me out with this.


[edited by: alt131 at 9:55 pm (utc) on May 29, 2012]
[edit reason] Thread Tidy [/edit]



 10:55 pm on May 29, 2012 (gmt 0)

Try changing to
background: url(../images/body-bg.jpg);
background-attachment: fixed;
background-repeat: no-repeat;
-moz-background-size:100% 100%;
background-size:100% 100%;

Read more here CSS3 Backgrounds [w3schools.com]



 11:07 pm on May 29, 2012 (gmt 0)

Thank you so much!

Huge help!


 12:09 am on May 30, 2012 (gmt 0)

You're welcome :)


Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / CSS
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved