Be Friendly
GoDaddy.com Hosting just $1.99/mo! 120x60  
Search This Site for Articles About...

The Advantages of Using CSS in an External File

The advantages of defining CSS file externally or separately from your main web page HTML file

One of the most obvious advantages of using CSS is perhaps when CSS is defined externally in a separate file. When your CSS file is defined externally it gives your site visitor browser an opportunity to cache (or store for later use) the CSS file.

By caching a CSS file, browsers effectively "memorize" it by saving it locally for later use. This way the CSS file need not to be downloaded again by returning visitors to your website.

Caching your stylesheet is a process that happens automatically inside your browser. You don't actually have to worry about it or how it works. Simply store your CSS code separately from your main website's HTML code and you will be taking advantage of caching. This reduces the number of HTTP requests and slightly helps your hosting server's bandwidth (because the CSS file is only downloaded once and stored locally on your computer).

Storing your CSS file externally allows you to easily and quickly change the style of your web page.

By storing your CSS file externally in a separate file, you gain exclusive access to what can be referred to as the site's CSS template code. Simply switching this CSS file with other files can allow your site to be customized without having to touch the HTML code of your web pages. This separation of code and visual style is very common in computing and even in other computer languages.

The ability to easily look at your CSS code and edit it as a separate file can also become important when you want to change CSS style of a web page dynamically, without having to refresh the page in your browser. This method of changing style sheets dynamically is called alternate stylesheets. Alternate Stylesheets have been a personal interest of mine, and I have yet to see a website that have properly used this unique stylesheet functionality. Although it would be interesting to see in action.

11

Thanks for visiting websitehomework.com - an website containing html tutorials covering topics such as how to make websites from scratch, css, javascript and other website-related subjects.

Privacy Policy | Legal Notice

© 2009-2011 and beyond. Copyright Greg Sidelnikov. All Rights Reserved. how to make french toast | 2001 DVD | starcraft 2 strategy & build order
bay area san francisco web design company | website template design generators | radiant heat floor warming system | new html tutorials
bora bora all inclusive | My email address: greg.sidelnikov@gmail.com
Website designed by Titanic Web Design San Francisco Web Design Company