Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting site for Retina-resolution screens

Tags:

css

Apple's new Macbook Pro has a 15" screen with a resolution of 2880x1800. At present it's scaling websites resulting in pixel-doubled images and a layout which appears double-scaled too.

As a web developer how do I go about converting my existing PHP/XHTML/CSS website to take advantage of high-DPI screens?

like image 872
Chris Beach Avatar asked Jun 19 '12 13:06

Chris Beach


2 Answers

The following page offers a decent run-through:

http://www.webmonkey.com/2012/06/make-sure-your-site-looks-good-on-the-new-retina-macbook-pro/

Icon fonts provide one solution, and the @media types allow additional styles to be used:

Example:

@media only screen and (min--moz-device-pixel-ratio: 2),
only screen and (-o-min-device-pixel-ratio: 2/1),
only screen and (-webkit-min-device-pixel-ratio: 2),
only screen and (min-device-pixel-ratio: 2) {
    .logo {
        background: url(/path/to/my/highreslogo.png) no-repeat;
        background-size: 100px 100px;
        /* rest of your styles... */
    }
}
like image 180
Chris Beach Avatar answered Oct 15 '22 05:10

Chris Beach


This script might help - http://retinajs.com/. You add @2x to your image names cut for retina display and the script does the rest. One pitfall when cutting the images is that everything must be divisible by two - which you already know, but this tripped me up as I made my buttons perfectly but ignored the 1px shadow/line around them, doh! :(

Edit: Just came across a really nice article/tutorial on the subject:

http://benfrain.com/how-to-serve-high-resolution-website-images-for-retina-displays-new-ipadiphone4/

like image 22
DBUK Avatar answered Oct 15 '22 07:10

DBUK