homepage Welcome to WebmasterWorld Guest from 54.227.12.219
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / CSS
Forum Library, Charter, Moderator: open

CSS Forum

    
Resize background image to browser size?
Tomtheman2




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

Hi,

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;
font-size:12px;
line-height:17px;
color:#634c31;
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.


Thanks,

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

 

Marshall




msg:4459231
 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]

Marshall

Tomtheman2




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

Thank you so much!

Huge help!

Marshall




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

You're welcome :)

Marshall

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