Table of Contents for
Responsive Web Design with HTML5 and CSS3 Essentials

Version ebook / Retour

Cover image for bash Cookbook, 2nd Edition Responsive Web Design with HTML5 and CSS3 Essentials by Asoj Talesra Published by Packt Publishing, 2016
  1. Cover
  2. Table of Contents
  3. Responsive Web Design with HTML5 and CSS3 Essentials
  4. Responsive Web Design with HTML5 and CSS3 Essentials
  5. Credits
  6. About the Authors
  7. About the Reviewer
  8. www.PacktPub.com
  9. Preface
  10. What you need for this book
  11. Who this book is for
  12. Conventions
  13. Reader feedback
  14. Customer support
  15. 1. Introducing Responsive Web Design
  16. Exploring how RWD works
  17. Understanding the elements of RWD
  18. Appreciating the importance of RWD
  19. Comparing RWD to adaptive design
  20. Preparing our development environment
  21. Considering a suitable strategy
  22. Exploring best practices
  23. Setting up a development workflow
  24. Exploring mistakes
  25. Summary
  26. 2. Creating Fluid Layouts
  27. Understanding the different layout types
  28. Setting the available viewport for use
  29. Exploring the benefits of flexible grid layouts
  30. Understanding the mechanics of grid layouts
  31. Implementing a prebuilt grid layout
  32. Exploring the use of flexbox
  33. Visiting the future
  34. Taking it further
  35. Summary
  36. 3. Adding Responsive Media
  37. Making video responsive
  38. Making text fit on screen
  39. Summary
  40. 4. Exploring Media Queries
  41. Understanding media queries
  42. Identifying common breakpoints
  43. Putting our theory into practice
  44. Creating some practical examples
  45. Examining some common mistakes
  46. Exploring best practices
  47. Taking things further
  48. Summary
  49. 5. Testing and Optimizing for Performance
  50. Understanding why pages load slowly
  51. Optimizing the performance
  52. Testing the performance of our site
  53. Best practices
  54. Providing support for older browsers
  55. Considering cross-browser compatibility
  56. Testing site compatibility
  57. Following best practices
  58. Summary

Understanding why pages load slowly

Although we may build a great site that works well across multiple devices, it's still no good if it is slow! Every website will of course operate differently, but there are a number of factors to allow for, which can affect page (and site) speed:

  • Downloading data unnecessarily: On a responsive site, we may hide elements that are not displayed on smaller devices; the use of display: none in code means that we still download content, even though we're not showing it on screen, resulting in slower sites and higher bandwidth usage.
  • Downloading images before shrinking them: If we have not optimized our site with properly sized images, then we may end up downloading images that are larger than necessary on a mobile device. We can of course make them fluid by using percentage-based size values, but if the original image is still too large, this places extra demand on the server and browser to resize them.
  • A complicated DOM in use on the site: When creating a responsive site, we have to add in a layer of extra code to manage different devices; this makes the DOM more complicated and slows our site down. It is, therefore, imperative that we don't add any any unnecessary elements that require additional parsing time by the browser.
  • Downloading media or feeds from external sources: It goes without saying that these are not under our control; if our site is dependent on them, then the speed of our site will be affected if these external sources fail.
  • Use of Flash: Sites that rely heavy on using Flash will clearly be slower to access than those that don't use the technology. It is worth considering if our site really needs to use it; recent changes by Adobe mean that Flash as a technology is being retired in favor of animation using other means such as HTML5 Canvas or WebGL.

There is one other point to consider, which we've not covered in this list; the average size of a page has significantly increased since the dawn of the Internet in the mid-nineties. Although these figures may not be 100% accurate, they still give a stark impression of how things have changed:

  • 1995: At that time, the average page size used to be around 14.1 KB. The reason for it can be that it contained around two or three embedded objects such as images. That meant just two or three calls to the server on which the website was hosted.
  • 2008: The average page size increased to around 498 KB in size, with an average use of around 70 objects that includes changes to CSS, images, and JavaScript. Although this is tempered with the increased availability of broadband, not everyone can afford fast access, so we will lose customers if our site is slow to load.

All is not lost though—there are some tricks we can use to help optimize the performance of our sites. Many of these apply equally to standard sites as well as responsive ones—let's take a look in more detail.