Getting Started with the basic Retina Support for WordPress

text-rendering
Let’s start at the beginning of our stylesheet (style.css)
|
1 2 3 |
body { text-rendering: optimizeLegibility; } |
Media Queries
moving toward the bottom where technically this would be just enough:
|
1 2 3 4 5 6 7 8 |
@media only screen and (-webkit-min-device-pixel-ratio:1.5), only screen and (-moz-min-device-pixel-ratio:1.5), only screen and (-o-min-device-pixel-ratio:3/2), only screen and (min-device-pixel-ratio:1.5) { body {} } |
The Future
|
1 2 3 4 5 6 7 8 9 10 |
@media only screen and (-webkit-min-device-pixel-ratio:1.5), only screen and (min-moz-device-pixel-ratio:1.5), only screen and (-o-min-device-pixel-ratio:3/2), only screen and (min-device-pixel-ratio:1.5), only screen and (min-resolution:192dpi), only screen and (min-resolution:2dppx) { body {} } |
Note that min--moz-device-pixel-ratio is for older Firefox browsers and older version of Firefox is something you’ll less likely be using with your new MacBook Pro anyways
Image Replacement
There are many different techniques out there, such as retina.js, however my favorite is picturefill. This might not be the best answer if you’re looking to replace already published images with HD version.
Resources
- High DPI Web Sites (ancient history – not recommended, but good to know)
- CSS media queries (Mozilla DEV)
- text-rendering (Mozilla DEV)
- Bug 474356 – Implement device-pixel-ratio (Mozilla)
- How to Develop for HiDPI (“Retina”) without a Retina MacBook Pro
I’m not sure why you’re linking to an article that explains the way to unprefix ‘-webkit-device-pixel-ratio’ is to use the standardized ‘resolution’ media query, and then not using the ‘resolution’ media query in your example.
Hi,
Article is there just in case
Thanks,
Emil
Just in case of what? Did you even read it? If so, why are you using an unprefixed ‘min-device-pixel-ratio’ query, which doesn’t exist anywhere, instead of ‘resolution’, which is part of the Media Queries standard?
Link removed to avoid confusion (I did read the article and it was tied to this post).
There’s a second (Future use) Media Queries included above.
As noted in my article fallbacks are not really needed, they’re included anyways.
P.S. I am a Firefox user and
min--moz-device-pixel-ratiowas edited as well. What I had before sounded like I was saying that we should not be using Firefox and what I meant was an older version of Firefox on brand new Mac.Thanks for the input,
Emil