Chapter 6. HTML optimization tips
This chapter covers
- Positioning CSS and JavaScript in a web page for best performance
- How CSS and JavaScript placement affects rendering
- The impact of duplicate scripts
- HTML5 optimization techniques
This chapter contains a collection of HTML best practices and tips that will improve the performance of your website. Some tips may seem like small changes, but they’ll go a long way toward improving the overall load time and responsiveness of your website. We’ll cover the optimal position in the HTML to place CSS and JavaScript, as well as the order in which they should appear.
You’ll learn a few HTML5 techniques and how you can apply these techniques to your application to achieve quicker load times. This chapter builds on the Surf Store application that you’ve been using thus far, and applies HTML5 techniques in different scenarios.
When you start building a new website, you may not be concerned with the order or location of the style sheets on your web page. However, their order and location play an important role in the way a browser renders a web page.
The position of CSS in an HTML document has less to do with download times, and more to do with how the browser reacts and renders the page. It’s all about perceived speed for the user!