This is the first post in a series about improving website performance.
Here's a simple tip that can significantly speed up your website loading time in the eyes of your visitors. Since HTML defines the structure of your page and CSS defines how your website is presented, modern browsers hang onto your content until you tell them how it should be displayed. This behavior is called progressive rendering.
Progressive rendering makes for a more responsive user experience.
If you use style tags throughout your page, or include external stylesheets in your page body,
most browsers avoid rendering until those styles are parsed. IE may avoid rendering entirely, leaving
your users to stare at a blank white page until everything is done loading. Declaring all of your styles
at the top of the page ensures that the browser can take full advantage of progressive rendering and display
content immediately. The HTML specification
confirms that all <link> tags should be within the document head.
JavaScript, on the other hand, should be saved until the very end of the page whenever possible.
When a browser comes across a script tag, it waits until that entire script executes before moving
on. Putting your scripts immediately before your closing </body> tag does two things:
Hope that improves the speed of your website! Read more tips at Yahoo.
I'm a Senior Culinary Software Developer at Yummly working on various front-end and middle-tier tasks, primarily using JavaScript. I blog about web design and development topics including accessibility, usability, performance, and developing HTML / CSS / JavaScript applications on Appcelerator Titanium and Adobe AIR.
If you're a web developer, you might enjoy Jelo, my JavaScript library.
All original work on this site is covered by a Creative Commons Attribution 3.0 license unless otherwise specified.
You may share or use any code or images from this site in any manner, for free, so long as reasonable effort has been made to give credit where due.
The views expressed in the posts and comments on this blog do not necessarily reflect those of my current or former employers.