-
Notifications
You must be signed in to change notification settings - Fork 12.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Warning about use of dpi in main.css #1474
Comments
According to http://drewwells.net/blog/2013/working-with-dppx/ , using both seems like a good idea. In devices that don't support dppx, hopefully they report dpi correctly. The following would probably be a good fallback: @media print,
(-o-min-device-pixel-ratio: 5/4),
(-webkit-min-device-pixel-ratio: 1.25),
(min-resolution: 1.25dppx),
(min-resolution: 120dpi) {
/* Style adjustments for high resolution devices */
} |
Also relevant to this discussion: https://bugs.webkit.org/show_bug.cgi?id=100865 |
So here are the findings: Here is the test case. Expected result on non-high-resolution displays is a red background, on high res displays the background should be green. With the updated media query I get all expected results for the following Browsers:
Not supported:
Problematic:
(Anyone of you fancy to test these?) I did not take care of non-highres iPhones since they are not wildly in use anymore, I think. This technique is not working on iOS Opera Mini (highres), it wasn't before too and I think Opera Mini does not support this rule. Maybe @andreasbovens can help here (#17)? I'd suggest extending the ruleset as stated above. Updated: 2014-04-18 13:34h GMT |
Probably not many but I'd guess a fairly high number of non-highres iPads. The @drublic test works well on a low resolution iPad for me. |
Oh true. I forgot these. Thanks for testing. I'll update the date later
|
Max OS X 10.9.2 Safari 7.0.2 and Chrome 33.0.1750.152 (latest) on a Retina MacBook Pro is working as expected. Green. |
OSX 10.9.2 Chrome Version 33.0.1750.152 MacBook Air 2013 — Red |
Mac rMBP Chrome & Firefox working (green). |
(DPI MQ - unsupported) Android 2.3 Browser - Red |
|
Android Opera Mini highres - Galaxy Nexus 4.3 - Green |
@stowball can you provide more details about:
such as the exact Chrome version, if it is a stable/beta/dev/canary release.... or anything that might help us identify why the test outputs red. Thanks! |
Windows 7 Opera 21(Next) highres - Red |
|
Stable, latest Chrome: 33.0.1750.154 m And here's the laptop I use: http://www.sony.com.au/product/svp1122ycg |
Sony Xperia P - Android 4.1.2 Green for all browsers below:
|
Samsung Galaxy Tab 3 - 7" - 600x1024 - Android v4.2.2
|
I've updated the test results above in #1474 (comment) The problematic browsers are non-IE browsers on high-res displays on Windows. I have looked into this: Essentially Windows does not really have a high resolution mode. You can only scale things up, from what I found. Maybe anyone has more experience with that? When I tested this on Windows with Chrome on a high-res display I had the problem, that Chrome itself looked like it was being scaled down by the OS. All websites were scaled as if they were on a 1dppx device. The original media query does not work in my tests for browsers other than IE on Windows. Does anyone know anything of the state of implementation in Chromium? My conclusion would be to add this media query as suggested. Reason being that it works better as before. I think browsers reporting false dppx is an issue with the implementation in those browsers. |
Firefox 28 on high res Win 8.1 - Green |
@drublic: desktop IE 11, Chrome and FF no high res is red as expected. |
Not sure what constitutes a hi-res desktop display outside of Apple products branded as 'retina'. I have a 2560x1600 30 inch Dell, works out to about 100ppi. |
Windows has an option to set a custom OS zoom level in percentages in the Configuration Panel (e.g. 150%). This then translates to a devicePixelRatio value of e.g. 1.5 in browsers that take this setting into account (e.g. Opera 25, possibly and likely others).
|
@andreasbovens is right. I never used more than the default 100% DPI on Windows :/ Anyway, here are my test results:
Gotta love IE for one more time... |
Thanks for that clarification andreasbovens. dpi @ 125% dpi @ 100% http://imgur.com/a/wnyUK - screenshots if they help. |
This media expression is used on http://apple.com:
It's likely a right choice.
|
Based on our findings and current situation in browsers here is my suggestion: I don't think we need
Right, @fronteed. So the new media query would be:
This is basically what Apple uses, @fronteed. This does not fix false-positives on Windows which result from a problem with Windows' hi-resolution mode. I don't think this is a problem we can handle which is why I would opt for not caring to much about it at the moment. Any more input on this issue? Are you happy with this solution? |
@drublic, @fronteed |
This commit adds a the dppx variant of min-resolution to add an easier to use value for the media query. `dppx` is not supported by all browsers and needs the `dpi` fallblack. `dppx` is more acurate than `dpi` since dots per inch refers to a defined size of pixels wher one inch is 96px what so ever and does not take physical inches into account. Autoprefixer will include `-webkit-min-device-pixel-ratio` which is needed for Safari and WebKit devices. Reference #1474.
This commit adds a the dppx variant of min-resolution to add an easier to use value for the media query. `dppx` is not supported by all browsers and needs the `dpi` fallblack. `dppx` is more acurate than `dpi` since dots per inch refers to a defined size of pixels wher one inch is 96px what so ever and does not take physical inches into account. Autoprefixer will include `-webkit-min-device-pixel-ratio` which is needed for Safari and WebKit devices. Reference #1474.
Thank you all for helping us test this! |
Add `dppx` variant of `min-resolution` to the high resolution media query as `dppx` is more accurate¹ than `dpi`. Notes: * since `dppx` is not supported by all browsers the media query still needs the `dpi` fallback * this change removes the `dppx` related warning² from Blink based browsers (e.g.: Chrome, Opera) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ¹ `dpi` (dots per inch) refers to a defined size of pixels where one inch is `96px` no matter what, so it does not take into consideration the physical inches. ² "Consider using 'dppx' units, as in CSS 'dpi' means dots-per-CSS-inch, not dots-per-physical-inch, so does not correspond to the actual 'dpi' of a screen. In media query expression: print, (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi)" Fix h5bp/html5-boilerplate#1474 Close h5bp/html5-boilerplate#1691
Add `dppx` variant of `min-resolution` to the high resolution media query as `dppx` is more accurate¹ than `dpi`. Notes: * since `dppx` is not supported by all browsers the media query still needs the `dpi` fallback * this change removes the `dppx` related warning² from Blink based browsers (e.g.: Chrome, Opera) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ¹ `dpi` (dots per inch) refers to a defined size of pixels where one inch is `96px` no matter what, so it does not take into consideration the physical inches. ² "Consider using 'dppx' units, as in CSS 'dpi' means dots-per-CSS-inch, not dots-per-physical-inch, so does not correspond to the actual 'dpi' of a screen. In media query expression: print, (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi)" Fix h5bp#1474 Close h5bp#1691
The following bit in the main.css throws up a warning in Chrome.
https://github.com/h5bp/html5-boilerplate/blob/master/css/main.css#L217
Warning:
A bit of researching as shows that dppx support is a bit lacking...
Source: https://developer.mozilla.org/en-US/docs/Web/CSS/resolution#Browser_compatibility
I'll try to do some tests today and update if I find anything about support if Safari.
The text was updated successfully, but these errors were encountered: