Responsive Web Design with HTML5 and CSS3 Essentials
By Asoj Talesra, Alex Libby and Gaurav Gupta
5/5
()
About this ebook
- Get to grips with the core functionality of RWD through examples
- Discover how to make layouts, content and media flexible, and explore why a content-first approach is more effective
- Maximize the performance of your web pages so that they work across all browsers and devices irrespective of the screen size
This book is for web designers who are familiar with HTML and CSS, and want to begin with responsive web design. Web development experience and knowledge of HTML5 and CSS3 is assumed.
Related to Responsive Web Design with HTML5 and CSS3 Essentials
Related ebooks
Mastering Bootstrap 4 Rating: 5 out of 5 stars5/5Learning Bootstrap Rating: 1 out of 5 stars1/5Express Web Application Development Rating: 3 out of 5 stars3/5Getting Started with React Rating: 0 out of 5 stars0 ratingsLearning jQuery 3 - Fifth Edition Rating: 0 out of 5 stars0 ratingsDjango Design Patterns and Best Practices Rating: 5 out of 5 stars5/5Node.js By Example Rating: 2 out of 5 stars2/5Responsive Media in HTML5 Rating: 0 out of 5 stars0 ratingsResponsive Design High Performance Rating: 0 out of 5 stars0 ratingsResponsive Web Design with HTML5 and CSS3 - Second Edition Rating: 4 out of 5 stars4/5Responsive Web Design with HTML5 and CSS3 Rating: 4 out of 5 stars4/5The CSS Guide: The Complete Guide to Modern CSS Rating: 5 out of 5 stars5/5HTML5 and CSS3: Building Responsive Websites Rating: 0 out of 5 stars0 ratingsBootstrap By Example Rating: 0 out of 5 stars0 ratingsWeb Design Playground: HTML & CSS The Interactive Way Rating: 5 out of 5 stars5/5JavaScript Unlocked Rating: 5 out of 5 stars5/5A Pocket Guide to CSS Animations Rating: 5 out of 5 stars5/5Professional CSS3 Rating: 5 out of 5 stars5/5Mastering JavaScript Rating: 4 out of 5 stars4/550 Recipes for Programming CSS3 Rating: 0 out of 5 stars0 ratingsHTML5 & CSS3 For Beginners: Your Guide To Easily Learn HTML5 & CSS3 Programming in 7 Days Rating: 4 out of 5 stars4/5Web Developer's Reference Guide Rating: 0 out of 5 stars0 ratingsProfessional JavaScript for Web Developers Rating: 0 out of 5 stars0 ratingsBootstrap 4 Quick Start: A Beginner's Guide to Building Responsive Layouts with Bootstrap 4 Rating: 0 out of 5 stars0 ratingsJavaScript and JSON Essentials Rating: 5 out of 5 stars5/5Mastering JavaScript: The Complete Guide to JavaScript Mastery Rating: 5 out of 5 stars5/5Learning HTML5 by Creating Fun Games Rating: 4 out of 5 stars4/5
Internet & Web For You
Principles of Web Design Rating: 0 out of 5 stars0 ratingsEverybody Lies: Big Data, New Data, and What the Internet Can Tell Us About Who We Really Are Rating: 4 out of 5 stars4/5Python: Learn Python in 24 Hours Rating: 4 out of 5 stars4/5Coding All-in-One For Dummies Rating: 4 out of 5 stars4/5Get Into UX: A foolproof guide to getting your first user experience job Rating: 4 out of 5 stars4/5Stop Asking Questions: How to Lead High-Impact Interviews and Learn Anything from Anyone Rating: 5 out of 5 stars5/5Cybersecurity For Dummies Rating: 5 out of 5 stars5/5Grokking Algorithms: An illustrated guide for programmers and other curious people Rating: 4 out of 5 stars4/5The $1,000,000 Web Designer Guide: A Practical Guide for Wealth and Freedom as an Online Freelancer Rating: 4 out of 5 stars4/5Notion for Beginners: Notion for Work, Play, and Productivity Rating: 4 out of 5 stars4/5Social Engineering: The Science of Human Hacking Rating: 3 out of 5 stars3/5Coding For Dummies Rating: 5 out of 5 stars5/5The Logo Brainstorm Book: A Comprehensive Guide for Exploring Design Directions Rating: 4 out of 5 stars4/5The Basics of User Experience Design by Interaction Design Foundation Rating: 4 out of 5 stars4/5Explain the Cloud Like I’m 10 Rating: 5 out of 5 stars5/5RESTful API Design - Best Practices in API Design with REST: API-University Series, #3 Rating: 5 out of 5 stars5/5Learn JavaScript in 24 Hours Rating: 3 out of 5 stars3/5Learn NodeJS in 1 Day: Complete Node JS Guide with Examples Rating: 3 out of 5 stars3/5UX/UI Design Playbook Rating: 4 out of 5 stars4/52022 Adobe® Premiere Pro Guide For Filmmakers and YouTubers Rating: 5 out of 5 stars5/5The Designer’s Guide to Figma: Master Prototyping, Collaboration, Handoff, and Workflow Rating: 0 out of 5 stars0 ratingsReact Projects: Build 12 real-world applications from scratch using React, React Native, and React 360 Rating: 0 out of 5 stars0 ratingsClassic Computer Science Problems in Python Rating: 0 out of 5 stars0 ratingsToken Economy: How the Web3 reinvents the Internet Rating: 4 out of 5 stars4/5Sad by Design: On Platform Nihilism Rating: 4 out of 5 stars4/5JavaScript All-in-One For Dummies Rating: 5 out of 5 stars5/5Deep Learning with Python Rating: 5 out of 5 stars5/5
Reviews for Responsive Web Design with HTML5 and CSS3 Essentials
1 rating0 reviews
Book preview
Responsive Web Design with HTML5 and CSS3 Essentials - Asoj Talesra
Table of Contents
Responsive Web Design with HTML5 and CSS3 Essentials
Credits
About the Authors
About the Reviewer
www.PacktPub.com
eBooks, discount offers, and more
Why subscribe?
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Introducing Responsive Web Design
Getting started with RWD
Exploring how RWD works
Understanding the elements of RWD
Controlling the viewport
Creating flexible grids
Making media responsive
Constructing suitable breakpoints
Appreciating the importance of RWD
Making our site accessible and intuitive
Organizing our content
Comparing RWD to adaptive design
Preparing our development environment
Considering a suitable strategy
Exploring best practices
Designing for touch
Setting up a development workflow
Discovering the requirements
Planning our site
Designing the text
Sketching our design
Prototyping and creating our design
Testing our design
Exploring mistakes
Summary
2. Creating Fluid Layouts
Introducing flexible grid layouts
Understanding the different layout types
Setting the available viewport for use
Balancing viewport against experience
Considering viewport units
Exploring the benefits of flexible grid layouts
Understanding the mechanics of grid layouts
Implementing a prebuilt grid layout
Exploring the use of flexbox
Taking a closer look
Visiting the future
Implementing a basic gallery grid
Exploring what happened
Taking it further
Summary
3. Adding Responsive Media
Making media responsive
Creating fluid images
Implementing the
Using the srcset attribute
Exploring the sizes attribute
Manipulating the HTML5
Putting it all together
Exploring what happened
Creating a real-world example
Taking things further
Making video responsive
Embedding externally hosted videos
Introducing the new HTML5 video element
Embedding HTML5 video content
Exploring what happened
Building a practical example
Exploring what happened
Exploring the risks
Making audio responsive
Taking things further
Making text fit on screen
Sizing with em units
Using rem units as a replacement
Exploring use of viewport units
Taking things further
Summary
4. Exploring Media Queries
Exploring some examples
Understanding media queries
Exploring the available media types
Listing the available media features
Introducing operators in our queries
Identifying common breakpoints
Creating custom breakpoints
Understanding the rationale
Taking care over our design
Removing the need for breakpoints
Putting our theory into practice
Creating some practical examples
Making it real
Exploring what happened
Detecting high-resolution image support
Exploring how it works
Examining some common mistakes
Exploring best practices
Taking things further
Summary
5. Testing and Optimizing for Performance
Understanding the importance of speed
Understanding why pages load slowly
Optimizing the performance
Starting with Google
Taking things further
Testing the performance of our site
Working through a desktop example
Viewing on a mobile device
Best practices
Providing support for older browsers
Considering which features to support
Let the user choose what they want
Do we need to include a whole library?
Considering cross-browser compatibility
Outlining the challenges
Understanding the drawbacks of JavaScript
Providing a CSS-based solution
Testing site compatibility
Working out a solution
Exploring tools available for testing
Viewing with Chrome
Working in Firefox
Exploring our options
Following best practices
Summary
Responsive Web Design with HTML5 and CSS3 Essentials
Responsive Web Design with HTML5 and CSS3 Essentials
Copyright © 2016 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 authors, 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: August 2016
Production reference: 1240816
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78355-307-5
www.packtpub.com
Credits
About the Authors
Alex Libby has a background in IT support. He has been involved in supporting end users for almost 20 years in a variety of different environments; a recent change in role now sees Alex working as an MVT test developer for a global distributor based in the UK. Although Alex gets to play with different technologies in his day job, his first true love has always been with the open source movement, and in particular experimenting with CSS/CSS3, jQuery, and HTML5. To date, Alex has written 11 books on subjects such as jQuery, HTML5 Video, SASS, and CSS for Packt, and has reviewed several more. Responsive Web Design with HTML5 and CSS3 Essentials is Alex's twelfth book for Packt, and second completed as a collaboration project.
Writing books has always been rewarding. It's a great way to learn new technologies and give back something to others who have yet to experience them. My thanks must go to Packt and my coauthors for letting me review and assist with editing this book. My special thanks must also go to family and friends for their support too—it helps get through the late nights!
Gaurav Gupta is a young and budding IT professional and has a good amount of experience of working on web and cross-platform application development and testing. He is a versatile developer and a tester and is always keen to learn new technologies to be updated in this domain. Passion about his work makes him stand apart from other developers.
Even at a relatively early stage of his career, he is a published author of two books, named Mastering HTML5 Forms and Mastering Mobile Test Automation with Packt Publishing.
A graduate in computer science, he currently works for a reputed Fortune 500 company and has developed and tested several web and mobile applications for the internal use.
Gaurav is a native of Chandigarh, India, and currently lives in Pune, India.
First of all, I would like to thank the almighty and my family, who have always guided me to walk on the right path in life. My heartfelt gratitude and indebtedness goes to all those people in my life who gave me constructive criticism, as it contributed directly or indirectly in a significant way toward firing up my zeal to achieve my goals. A special thanks to my sister, Anjali, who is a constant support, always.
Asoj Talesra is an enthusiastic software developer with strong technical background. As a hybrid mobile app developer, he is responsible for crafting and developing intuitive, responsive web pages, and mobile apps using HTML5, CSS3, JavaScript, AngularJS, jQuery, jQuery Mobile, Xamarin, and Appcelerator Titanium. He works with a Fortune 500 company, and is well experienced in the areas of banking, quality and compliance, and audit.
About the Reviewer
Sasan Seydnejad has more than a decade of experience in web UI and frontend application development using JavaScript, CSS, and HTML in .NET and ASP.NET environments. He specializes in modular SPA design and implementation, responsive mobile-friendly user interfaces, AJAX, client architecture, and UX design, using HTML5, CSS3, and their related technologies. He implements framework-less and framework-based applications using Node.js, MongoDB, Express.js, and AngularJS. He is the holder of the US patent for a user interface for a multidimensional data store—US Patent 6907428.
www.PacktPub.com
eBooks, discount offers, and more
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.
https://www2.packtpub.com/books/subscription/packtlib
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books.
Why subscribe?
Fully searchable across every book published by Packt
Copy and paste, print, and bookmark content
On demand and accessible via a web browser
Preface
A question—how many devices do you own that can access the Internet?
As a user, I'll bet the answer is likely to be quite a few; this includes smart TVs, cell phones, and the like. As developers, it is up to us to provide a user experience that works on multiple devices. Welcome to the world of responsive design!
Responsive design is not only all about creating a great user experience, but one that works well on multiple different devices, from a simple online ordering process for tickets, right through to an extensive e-commerce system. Many of the tips you see throughout the course of this book don't require extensive changes to your existing development methodology. In many cases, it's enough to make some simple changes to begin building responsive sites.
Creating responsive sites can open up a real world of opportunity for you; over the course of this book, I'll introduce you to the essential elements that you need to be aware of when designing responsively, and provide you with examples and plenty of tips to help get you started with creating responsive designs.
Are you ready to get started? Here's hoping the answer is yes. If so, let's make a start.
What this book covers
Chapter 1, Introducing Responsive Web Design, kicks off our journey into the world of responsive design, with an introduction into the basics of the concept; we explore the importance of RWD in today's environment and examine how it works as a concept.
Chapter 2, Creating Fluid Layouts, takes a look at creating flexible grid layouts as a key element of our design process; we explore the benefits of using them, and take a look at creating some examples using prebuilt styles.
Chapter 3, Adding Responsive Media, walks us through how to make our media responsive. We cover some of the tips and tricks available for use and examine why, in some cases, it is preferable to host content externally (such as videos)—if only to save on bandwidth costs!
Chapter 4, Exploring Media Queries, leads us to explore media queries and how we can use them to control what content is displayed at particular screen width settings. We cover the basics of creating breakpoints and examine why these should be based around where content breaks in our design and not simply for specific devices we want to support.
Chapter 5, Testing and Optimizing for Performance, rounds off our journey through the essentials of responsive web design with a look at how we can test and optimize our code for efficiency. We explore some of the reasons why pages load slowly, how we can measure our performance, and understand why even though the same tricks can be applied to any site. It's even more critical that we incorporate them when designing responsively.
What you need for this book
All you need to work through most of the examples in this book is a simple text or code editor, an Internet browser, and Internet access. Many of the demos use Google Chrome, so it is ideal if you have this installed; other browsers can be used, although there may be instances where you have to change the steps accordingly.
Who this book is for
The book is for frontend developers who are familiar with HTML5 and CSS3, but want