<< The new iPads and our websites | Home | Internet Explorer 10 is out >>

CSS3 Media Query Testbed

the web developer 101

I've written quite a few articles on the css3 media queries and I thought I'd clarify my work on the subject and give a little more info on the context of these articles.

First of all, what I wanted to do was to build a database of the various values one can expect to be supported by the various devices out there. And this is not a simple task, so I did set up a "test environment".

Some context

All this is the context I run my tests in. This is also the context in which I run my websites in. It's also incidentally the setup I encourage everyone to develop their websites with, because it's the one that gives the most control to the web designer and it also is the one that makes the browsers work in the most predictable way.

Naturally, it's the setup I used for my CSS media queries test.

The test environment

  • The browser should be in strict mode (aka standards mode). This is done by defining a doctype as the very first thing in a HTML page. For example:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    Or, if you don't use XHTML:
    <!DOCTYPE html>
    More on this at quirksmode.org.

  • Then, one should define a meta attribute specifying the viewport as being equal to the device size. This is done by adding a meta element to the head section of an html document. The last bit specifies on iPhones with notches that when in landscape mode the website should only use the safe area. For example:
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover"/>
    More on this at Mozilla and at Apple.

  • Since Microsoft likes to make things so completely screwed up, they decided that the above viewport declaration would not be enough in IE 10. So they decide to invent their very specific way of doing the very same thing, plus more useless other things. So in your CSS you should also have the following definition:
    @-ms-viewport { width: device-width; }
    You can see the rationale behind this on msdn.

  • After that, webkit must be told not to adjust sizes when switching from portrait to landscape mode. This is done by defining a CSS property for the html element. Just add the following CSS snippet to any stylesheet in your html document:
    html { -webkit-text-size-adjust: 100%; }
    Contrary to Apple's documentation on the subject, this affects all webkit-based browsers. So you should not use the none value (this screws up zooming on the desktop browsers) but the 100% value which does the trick nicely without messing with desktop browsers.

  • As a bonus, I also usually add the following meta element to everything. It makes almost no difference in terms of design, but it prevents browsers to automatically detect phone numbers in a web page. This saves client-side CPU and makes the display of numbers much more predictable, as browsers will "highlight" things they believe to be phone numbers, changing their font, colors and decoration.
    <meta name="format-detection" content="telephone=no">
    More on this at Apple.

iOS 9

iOS 9 is out, and they changed something of importance. With the setup above, your website will not be zoomable, which is what you want because zooming in and out is a bad user experience. But, what if the content is too wide? Well, in iOS < 9, you could scroll horizontally. This is not perfect by any means, but the content is viewable.

In iOS9, it will show the whole width, zooming out your website, and the user has the ability to zoom in. This is (IMO) much worse than the iOS8 behavior.

So, you now need to be extra careful about the content. Often a simple overflow:auto is enough but your mileage may vary.

Tags : , ,

Re: CSS3 Media Query Testbed

Thanks a lot saved me tons of time!
Avatar: pieroxy

Re: CSS3 Media Query Testbed

Why visitors still make use of to read news papers when in this technological globe everything is accessible on net?
Avatar: pieroxy

Re: CSS3 Media Query Testbed

I am curious to find out what blog platform you happen to be working with? I'm experiencing some small security problems with my latest blog and I'd like to find something more safeguarded. Do you have any suggestions?
Avatar: pieroxy

Re: CSS3 Media Query Testbed

Someone essentially assist to make significantly posts I would state. That is the first time I frequented your web page and thus far? I surprised with the research you made to create this actual publish extraordinary. Excellent process!
Avatar: pieroxy

Re: CSS3 Media Query Testbed

This post gives clear idea for the new visitors of blogging, that truly how to do blogging.
Avatar: Evden Eve Nakliye

Re: CSS3 Media Query Testbed

Good way of describing, and good piece of writing to get data about my presentation topic, which i am going to convey in academy.
Avatar: ghaziabad escort service

Re: CSS3 Media Query Testbed

Nice post. I was checking constantly this blog and I am impressed! Very helpful information specifically the last part : ) I care for such info a lot. I was seeking this certain info for a very ling time. Thank you and good luck. my web-site; ghaziabad escort service
Avatar: Therese

Re: CSS3 Media Query Testbed

It's a shame you don't have a donate button! I'd definitely donate to this outstanding blog! I guess for now i'll settle for bookmarking and adding your RSS feed to my Google account. I look forward to brand new updates and will share this site with my Facebook group. Talk soon!
Avatar: Ashetell

fipsyinx

Avatar: DavidPrevy

hpytifph

Avatar: Elwoodparee

cneqfrvl

Avatar: Elsa

cneqfrvl

Good information. Lucky me I found your website by chance (stumbleupon). I've book marked it for later!
Avatar: Lukas

cneqfrvl

I was curious if you ever thought of changing the page layout of your blog? Its very well written; I love what youve got to say. But maybe you could a little more in the way of content so people could connect with it better. Youve got an awful lot of text for only having 1 or two pictures. Maybe you could space it out better?
Avatar: Val

cneqfrvl

You've made some decent points there. I checked on the internet for more information about the issue and found most people will go along with your views on this site.
Avatar: Akilah

cneqfrvl

It's difficult to find knowledgeable people about this subject, but you seem like you know what you're talking about! Thanks
Avatar: https://sites.google.com/view/balakrishnan-real-estate-group/real-estates

cneqfrvl

I'm gone to say to my little brother, that he should also pay a quick visit this website on regular basis to get updated from most up-to-date news.
Avatar: here

cneqfrvl

Ahaa, its nice conversation concerning this piece of writing at this place at this webpage, I have read all that, so now me also commenting here.
Avatar: Valorie

cneqfrvl

Yes! Finally something about have a peek at this web-site.
Avatar: continue reading this

cneqfrvl

It's an remarkable piece of writing in favor of all the online people; they will obtain advantage from it I am sure.
Avatar: Eyeetell

hdrnmhqn

Avatar: Samuellinny

ajuejpgl

Avatar: Tommie

ajuejpgl

It's remarkable to pay a quick visit this web page and reading the views of all mates concerning this piece of writing, while I am also eager of getting knowledge.
Avatar: Sue

ajuejpgl

Everything is very open with a precise explanation of the challenges. It was really informative. Your site is extremely helpful. Many thanks for sharing!
Avatar: Bob

ajuejpgl

It's the best time to make a few plans for the longer term and it's time to be happy. I've learn this put up and if I may I want to recommend you some attention-grabbing things or advice. Perhaps you can write next articles relating to this article. I wish to learn more things about it!
Avatar: https://bbarlock.com/

ajuejpgl

I'm curious to find out what blog platform you have been using? I'm experiencing some minor security problems with my latest blog and I'd like to find something more secure. Do you have any suggestions?
Avatar: Nickolas

ajuejpgl

I know this if off topic but I'm looking into starting my own blog and was curious what all is required to get set up? I'm assuming having a blog like yours would cost a pretty penny? I'm not very internet savvy so I'm not 100% sure. Any tips or advice would be greatly appreciated. Cheers
Avatar: Sammie

ajuejpgl

If some one needs expert view concerning blogging then i advise him/her to pay a visit this web site, Keep up the good job.
Avatar: click4r.com

ajuejpgl

Do you have a spam problem on this site; I also am a blogger, and I was wanting to know your situation; we have created some nice procedures and we are looking to exchange techniques with others, be sure to shoot me an e-mail if interested.
Avatar: Ali

ajuejpgl

Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point. You obviously know what youre talking about, why throw away your intelligence on just posting videos to your weblog when you could be giving us something enlightening to read?
Avatar: Hung

ajuejpgl

Hi colleagues, its impressive piece of writing about teachingand entirely explained, keep it up all the time.
Avatar: Lavina

ajuejpgl

Truly when someone doesn't understand then its up to other viewers that they will help, so here it occurs.
Avatar: Bradly

ajuejpgl

Aw, this was a very good post. Taking the time and actual effort to create a great article… but what can I say… I put things off a whole lot and don't seem to get nearly anything done.
Avatar: Fiona

ajuejpgl

What's up, just wanted to tell you, I enjoyed this blog post. It was inspiring. Keep on posting!
Avatar: Damian

ajuejpgl

Spot on with this write-up, I actually believe this amazing site needs a great deal more attention. I'll probably be returning to read through more, thanks for the information!
Avatar: Cecila

ajuejpgl

I am regular reader, how are you everybody? This paragraph posted at this web page is actually pleasant.
Avatar: Thaddeus

ajuejpgl

You are so cool! I do not suppose I've read something like that before. So nice to find another person with a few original thoughts on this subject. Really.. thank you for starting this up. This web site is something that is required on the web, someone with some originality!
Avatar: Jami

ajuejpgl

Peculiar article, just what I wanted to find.
Avatar: Adeline

ajuejpgl

You actually make it seem so easy with your presentation but I find this topic to be actually something that I think I would never understand. It seems too complicated and extremely broad for me. I am looking forward for your next post, I will try to get the hang of it!
Avatar: Penney

ajuejpgl

I really like looking through a post that can make men and women think. Also, thank you for allowing me to comment!
Avatar: Irish

ajuejpgl

Good day very nice site!! Guy .. Excellent .. Amazing .. I will bookmark your web site and take the feeds additionally? I am satisfied to search out numerous helpful information right here within the submit, we want develop more techniques in this regard, thanks for sharing. . . . . .
Avatar: visit the website

ajuejpgl

Paragraph writing is also a excitement, if you be acquainted with afterward you can write otherwise it is complicated to write.
Avatar: pastelink.net

ajuejpgl

Excellent pieces. Keep writing such kind of information on your blog. Im really impressed by your blog. Hi there, You have performed an incredible job. I'll certainly digg it and in my opinion suggest to my friends. I am confident they will be benefited from this site.
Avatar: visit homepage

ajuejpgl

Great post.
Avatar: Muoi

ajuejpgl

Pretty! This was an incredibly wonderful article. Thank you for providing these details.
Avatar: Derick

ajuejpgl

I like it when people get together and share thoughts. Great blog, stick with it!
Avatar: Minerva

ajuejpgl

Heya i am for the primary time here. I came across this board and I to find It really helpful & it helped me out much. I'm hoping to present something back and help others such as you aided me.
Avatar: Casie

ajuejpgl

Excellent post. I absolutely love this website. Thanks!
Avatar: Adalberto

ajuejpgl

This is a topic that is close to my heart... Best wishes! Exactly where are your contact details though?
Avatar: wiki-quicky.win

ajuejpgl

Hey very interesting blog!
Avatar: Nicole

ajuejpgl

I enjoy reading through an article that can make men and women think. Also, thank you for allowing me to comment!
Avatar: Lucille

ajuejpgl

of course like your web site however you have to check the spelling on several of your posts. Many of them are rife with spelling problems and I in finding it very troublesome to inform the reality nevertheless I'll surely come again again.
Avatar: Marisa

ajuejpgl

I believe this is among the such a lot significant information for me. And i am happy studying your article. But want to statement on few basic issues, The web site style is perfect, the articles is truly excellent : D. Excellent activity, cheers
Avatar: Tammie

ajuejpgl

Having read this I believed it was rather enlightening. I appreciate you spending some time and effort to put this short article together. I once again find myself personally spending a lot of time both reading and leaving comments. But so what, it was still worth it!
Avatar: Antje

ajuejpgl

Hi there mates, its wonderful piece of writing about educationand entirely explained, keep it up all the time.
Avatar: sites.google.com

ajuejpgl

There is certainly a great deal to know about this issue. I love all the points you made.
Avatar: website link

ajuejpgl

Greetings from Colorado! I'm bored at work so I decided to check out your website on my iphone during lunch break. I love the knowledge you present here and can't wait to take a look when I get home. I'm surprised at how quick your blog loaded on my phone .. I'm not even using WIFI, just 3G .. Anyhow, wonderful blog!
Avatar: go to the website

ajuejpgl

I’m not that much of a internet reader to be honest but your sites really nice, keep it up! I'll go ahead and bookmark your website to come back in the future. Many thanks
Avatar: Elwoodparee

rcmkbimi

Avatar: Maryetell

rgdnnzrsj

Avatar: Curtissor

rnkdjkhq

Avatar: Eyeetell

sudbplah

Avatar: DavidPrevy

zkddkqcl

Avatar: Josephfeshy

nryixkii

Avatar: DarrylDraks

oshvmzzy

Avatar: Elwoodparee

mufttgzj

Avatar: Ashetell

ktshwabq

Avatar: Elwoodparee

hykbfkgy

Avatar: DavidPrevy

qiqxtzut

Avatar: WilliamGIZ

uzgwpway

Avatar: Curtissor

dqrlukhb

Avatar: Maryetell

revtdcbhg

Avatar: MichaelRon

bpluywwx

Avatar: DarrylDraks

ydvbrdno

Avatar: Josephfeshy

ngrdterw

Avatar: Curtissor

mvalfvvz

Avatar: Elwoodparee

exvixgif

Avatar: Elwoodparee

qaydqxht

Avatar: Ashetell

hfpotqwe

Avatar: DavidPrevy

eapcgfyh

Avatar: Evden Eve Nakliye

Re: CSS3 Media Query Testbed

Hey There. I found your blog using msn. This is a very well written article. I'll be sure to bookmark it and come back to read more of your useful info. Thanks for the post. I will definitely return.
Avatar: Bats Knife MM2 Value

Re: CSS3 Media Query Testbed

Hi there friends, its great piece of writing regarding teachingand completely explained, keep it up all the time.
Avatar: Ashley

Re: CSS3 Media Query Testbed

I do not even understand how I ended up right here, but I assumed this put up used to be great. I don't realize who you're but definitely you're going to a well-known blogger in case you aren't already. Cheers!
Avatar: Earnestine

Re: CSS3 Media Query Testbed

Hey There. I found your blog the usage of msn. This is a very smartly written article. I will be sure to bookmark it and come back to read more of your helpful info. Thank you for the post. I'll certainly comeback.
Avatar: 8bitknifemm2database.wordpress.com

Re: CSS3 Media Query Testbed

I'm gone to inform my little brother, that he should also pay a quick visit this blog on regular basis to get updated from latest news.
Avatar: apocalypse knife murder mystery 2

Re: CSS3 Media Query Testbed

Today, I went to the beach front with my children. I found a sea shell and gave it to my 4 year old daughter and said "You can hear the ocean if you put this to your ear." She placed the shell to her ear and screamed. There was a hermit crab inside and it pinched her ear. She never wants to go back! LoL I know this is entirely off topic but I had to tell someone!
Avatar: mm2aurora2019depot.wordpress.com

Re: CSS3 Media Query Testbed

Very quickly this website will be famous amid all blog users, due to it's good content
Avatar: candycorn2020mm2tradeinsights.wordpress.com

Re: CSS3 Media Query Testbed

I read this paragraph completely about the resemblance of most up-to-date and earlier technologies, it's remarkable article.
Avatar: Buy Camo MM2

Re: CSS3 Media Query Testbed

Ahaa, its pleasant dialogue regarding this article at this place at this weblog, I have read all that, so at this time me also commenting at this place.
Avatar: Candleflame Knife MM2

Re: CSS3 Media Query Testbed

You've made some good points there. I looked on the web for more information about the issue and found most people will go along with your views on this web site.
Avatar: Candleflame MM2

Re: CSS3 Media Query Testbed

I'm not sure where you're getting your info, but great topic. I needs to spend some time learning much more or understanding more. Thanks for excellent info I was looking for this info for my mission.
Avatar: Elvia

Re: CSS3 Media Query Testbed

Hello, Neat post. There's an issue with your web site in web explorer, would test this? IE nonetheless is the market leader and a huge part of other people will leave out your wonderful writing because of this problem.
Avatar: Brush Knife MM2

Re: CSS3 Media Query Testbed

I was recommended this blog via my cousin. I am now not sure whether or not this put up is written by him as no one else realize such detailed about my difficulty. You're incredible! Thank you!
Avatar: Candy Corn 2022 Knife MM2 Value

Re: CSS3 Media Query Testbed

We stumbled over here from a different web page and thought I may as well check things out. I like what I see so now i am following you. Look forward to looking into your web page yet again.
Avatar: Buy Candleflame Knife MM2

Re: CSS3 Media Query Testbed

I have learn several good stuff here. Definitely value bookmarking for revisiting. I wonder how much attempt you put to make this sort of magnificent informative website.
Avatar: Buy Camo MM2

Re: CSS3 Media Query Testbed

This design is wicked! You obviously know how to keep a reader entertained. Between your wit and your videos, I was almost moved to start my own blog (well, almost...HaHa!) Wonderful job. I really enjoyed what you had to say, and more than that, how you presented it. Too cool!
Avatar: Kathryn

Re: CSS3 Media Query Testbed

Your mode of explaining everything in this piece of writing is genuinely nice, all can effortlessly be aware of it, Thanks a lot.
Avatar: Camo MM2

Re: CSS3 Media Query Testbed

Hmm it seems like your blog ate my first comment (it was super long) so I guess I'll just sum it up what I submitted and say, I'm thoroughly enjoying your blog. I as well am an aspiring blog writer but I'm still new to the whole thing. Do you have any points for novice blog writers? I'd really appreciate it.
Avatar: Buy Bunny Knife MM2

Re: CSS3 Media Query Testbed

Hey! Quick question that's entirely off topic. Do you know how to make your site mobile friendly? My site looks weird when viewing from my apple iphone. I'm trying to find a theme or plugin that might be able to correct this problem. If you have any suggestions, please share. Cheers!
Home