Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-03-2011, 09:30 PM   PM User | #1
Daniel_A_Varney
Regular Coder

 
Join Date: Jul 2011
Posts: 105
Thanks: 12
Thanked 1 Time in 1 Post
Daniel_A_Varney is an unknown quantity at this point
Scaling Background Images?

Is it possible to scale DIV background images as the user zooms the site if the site uses EM units of measurement? I need to do this to stop my design layout falling apart when users resize their text. My designs are very carefully planned and executed, therefore I do not want my pages to look bad in the event of viewers messing with their browser's settings.

Thanks.
Daniel_A_Varney is offline   Reply With Quote
Old 07-04-2011, 04:28 AM   PM User | #2
sunfighter
Senior Coder

 
Join Date: Jan 2011
Location: Missouri
Posts: 2,383
Thanks: 18
Thanked 350 Times in 349 Posts
sunfighter is on a distinguished road
I know you can use javascript to obtain the window size and work accordingly, but CSS3 does have a solution.

html {
background: url(images/bg.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}

And that works great! But to does depend on original size and the ratios. It tries to keep the ratios the same.

Last edited by sunfighter; 07-04-2011 at 04:35 AM..
sunfighter is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:54 PM.


Advertisement
Log in to turn off these ads.