Go Back   CodingForums.com > :: Client side development > General web building > Building for mobile devices

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 06-30-2012, 10:17 AM   PM User | #1
hdewantara
Regular Coder

 
hdewantara's Avatar
 
Join Date: Aug 2009
Location: Jakarta, Indonesia.
Posts: 287
Thanks: 4
Thanked 39 Times in 39 Posts
hdewantara is an unknown quantity at this point
A Discrete CSS Media Queries ?

I've recently read these 2 articles: Responsive Web Design by Ethan Marcotte, and also this one by Jason Grigsby's about CSS Media Query for Mobile is Fool’s Gold, and now I got confused. How should I make my site responsive without using % in images

And then I thought, why don't I just making a discrete intervals for that? Say that I have basic webpage with one image in it (as background), and the query for that image would be as follows:
PHP Code:
@media all and (max-width:320px){
    .
page{background-image:url('back-300px-wide.jpg');}
}
@
media all and (min-width:320px) and (max-width:420px){
    .
page{background-image:url('back-370px-wide.jpg');}
}
@
media all and (min-width:420px) and (max-width:520px){
    .
page{background-image:url('back-470px-wide.jpg');}
}
@
media all and (min-width:520px){
    .
page{background-image:url('back-570px-wide.jpg');}

So there are 4 images to be prepared, back-300px-wide.jpg is the one with narrowest width, and back-570px-wide.jpg is the largest. And the question is... would a browser - say Safari on iPhone - still loading all 4 of them? Is that query code above a bad idea?

Thanks for any inputs.

Kind regards,
Hendra
hdewantara is offline   Reply With Quote
Old 12-12-2012, 10:44 PM   PM User | #2
StevenHu
Regular Coder

 
Join Date: Jun 2011
Location: CA
Posts: 105
Thanks: 0
Thanked 10 Times in 10 Posts
StevenHu is an unknown quantity at this point
I would not go that route, making four images for each picture. What about higher-density displays that are coming out? How many more different images will you make then? Besides, there really isn't much difference in bandwidth use between a 300px and 370px image. That's overkill.
__________________
Steve Husting
http://iphonedevlog.wordpress.com
StevenHu 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 08:38 AM.


Advertisement
Log in to turn off these ads.