www.it-ebooks.info Instant Website Optimization for Retina Displays How-to Learning simple techniques which will make your website look stunning on high-definition Retina Displays Kyle J. Larson BIRMINGHAM - MUMBAI www.it-ebooks.info Instant Website Optimization for Retina Displays How-to Copyright © 2013 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. First published: January 2013 Production Reference: 1160113 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-84969-512-1 www.packtpub.com www.it-ebooks.info Credits Author Project Coordinator Kyle J. Larson Amigya Khurana Reviewer Proofreader Jan Rajtoral Aaron Nash IT Content Commissioning Editor Production Coordinator Grant Mizen Prachali Bhiwandkar Commissioning Editor Cover Work Maria D'souza Prachali Bhiwandkar Technical Editor Cover Image Worrell Lewis Sheetal Aute www.it-ebooks.info About the Author Kyle Larson is a self-taught web designer and front-end developer who has been passionate about the power of networks since he got his first modem at the age of 10. He studied art and design at the University of Minnesota while working for http://www.techies.com/, a job search start-up. Kyle is currently a Senior Web Designer, designing for a variety of brands, at Milestone AV Technologies in Minnesota. He also does freelance work with Emergent Networks and a variety of small businesses. When he's not buried in a web project, Kyle blogs about what he learns at http://www.kylejlarson.com/. I'd like to thank: My parents, Jim and Nancy, and my sister, Caitlin, for being the best family I could ask for and pretending to understand my technobabble. Steve and Barb for being fun and always supportive. Jessi for being all-around awesome and always understanding when my schedule gets crazy. My buddies Justin, Brian, Brandon, Danny, Andy, and Elliot for the great breaks from writing. Fore! www.it-ebooks.info About the Reviewer Jan Rajtoral, aka Gonzo the Great, is the founder of and designer at gonzodesign, a Dutch design studio providing design services across the full spectrum of graphic design and (responsive) web design. He also writes for http://www.gonzoblog.nl/, where above everything else, his passion for writing, technology, communication, and design drives him to contribute. www.it-ebooks.info www.PacktPub.com Support files, eBooks, discount offers and more You might want to visit www.PacktPub.com for support files and downloads related to your book. Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details. At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks. http://PacktLib.PacktPub.com Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read and search across Packt's entire library of books. Why Subscribe? f Fully searchable across every book published by Packt f Copy and paste, print and bookmark content f On demand and accessible via web browser Free Access for Packt account holders If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access. www.it-ebooks.info Table of Contents Preface 1 Instant Website Optimization for Retina Displays How-to 5 Creating your first Retina image (Must know) 5 Retina background images (Must know) 8 Optimizing (Must know) 9 Creating image sprites (Should know) 12 CSS border images (Should know) 15 CSS media queries (Should know) 17 CSS image-set (Become an expert) 20 Using code instead of images (Must know) 22 Embedding fonts (Should know) 26 Fonts as icons (Should know) 28 High-resolution web apps (Should know) 30 Scalable Vector Graphics (Become an expert) 34 Canvas (Become an expert) 36 Pixel ratio detection with JavaScript (Become an expert) 39 Server-side Retina solutions (Become an expert) 42 www.it-ebooks.info www.it-ebooks.info Preface Instant Website Optimization for Retina Displays How-to is a comprehensive guide to building a website that looks fantastic on high pixel density displays. Helpful insights and simple instructions walk you through all the various methods of optimizing your site for the latest mobile and desktop devices. Apple launched its line of high pixel density, Retina Display products with the iPhone 4 and has continued to integrate the technology into its other products. A high pixel density display typically has one and a half to two times the amount of pixels per inch of a traditional display. This makes the pixels nearly invisible to the human eye. These beautiful displays take computing to a new level with incredibly sharp text and graphics. Apple's marketing of the Retina brand popularized the high pixel density display, but the techniques in this book apply to many other manufacturers' devices with similar displays. As these displays become cheaper to manufacture, high-density graphics will become the new standard for the apps and websites of the future. This book begins by covering the basics of Retina images and dives right into practical advice so you can start improving your website's images. It continues building on the basic techniques with simple recipes covering all the tools you'll need to make an impressive Retina website. We will take a look at the techniques for adding Retina backgrounds, sprites, and border images. You will learn how to optimize your site, loading large images only when needed to keep it running fast. We will create a variety of basic shapes and styles using CSS that can be used instead of graphics in your user interface. We'll cover scalable image techniques, including using fonts as icons and implementing Scalable Vector Graphics (SVG), which make your graphics look great on any device. After reading Instant Website Optimization for Retina Displays How-to you'll have mastered the techniques to make creating high-density websites easy. www.it-ebooks.info