Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Does CSS inscrease loading times

Status
Not open for further replies.

Bravogolf

Programmer
Nov 29, 2002
204
GB
Hi all,
Just a quick question. Does the use of CSS increase loading times on a website, instead of using images, or inherent style tags?

:)
 
not that i know of...

Known is handfull, Unknown is worldfull
 
there are 3 ways of using css:
[ol]
[li]Use a seperate (linked or imported) stylesheet:
[tt]<link rel="stylesheet" type="text/css" href="mycssfile.css">[/tt][/li]
[li]Declare the css in the head:
[tt]<style type="text/css">
/* all your css declarations go in here */
</style>
[/tt][/li]
[li]Declare the css inline on an element:
[tt]<a href="somelink.html" style="font-weight: bold;">some link text</a>[/tt][/li]
[/ol]
Method 1 will result in the client making a seperate Get request to the server (for the css file).

Methods 2 and 3 won't require extra loading, but they'll increase the file size of the html document, so loading of the page may be slower.


In general, css replaces complex presentational markup, reducing the amount of html by a huge factor - and reducing download time of the html page by the same factor.
If you share a common css file amongst all the files on your site, the browser will generally have cached the file - hence, it will be much much quicker.

<marc> i wonder what will happen if i press this...[ul][li]please tell us if our suggestion has helped[/li][li]need some help? faq581-3339[/li][/ul]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top