PDA

View Full Version : What is better: external or internal Styles


hogtied
01-31-2003, 10:11 PM
Hello members,

I was thinking on whether I should do my styles external or internal. And pondered on a few concepts.

If it's interenal
Server Requests: 1
Maintaing: (if more than 1 page uses the same styles) make changes on many pages many times
Conclusion: better performance, poor maintance.

If it's external
Server Requests: 2 .htm and .css
Maintaing: make changes one page one time
Conclusion: better maintance, poor performance.

What were to happen if the server in that split second after the request for the .htm file went down. Then the page would be displayed as is without the styles. Or if the internet had some pretty bad lag, then the user would see the page as is then see it switch to the page that was meant to be seen with the styles.

This is my understanding of CSS but what I would like is to get your opinons on the matter.

Thanks
Hogtied :thumbsup:

Roy Sinclair
01-31-2003, 10:18 PM
If it's external
Server Requests: 2 .htm and .css
Maintaing: make changes one page one time
Conclusion: better maintance, poor performance.


For one page your conclusion holds true, but when the visitor hits a second page in your site which calls the external CSS there's only one request to the server because the CSS file is already cached and now the second page is smaller by the size of the CSS and the advantage is again on the side of the external sheet. An advantage which grows with every additional page on your site which uses the same external CSS that the visitor navigates to.

hogtied
01-31-2003, 11:57 PM
If it's external
Server Requests: 2 (.htm and .css)
Maintaing: make changes one page one time
Conclusion: better maintance, poor performance.


This is assuming you never been to the site before. In this instance you would make 2 server requests.

pb&j
02-01-2003, 05:24 AM
No choice for both?

I like external because I only have to edit one file to make a general change plus it saves me alot of typing (or copypaste) into the head area of each page requiring it.

Plus, wouldn't having the coding on each page increase the ultimate size of each page and thus create that slight delay time itself anyways?

I also like internal because some page use a specific coding that I don't really need on all my other pages.

redhead
02-01-2003, 09:50 AM
What were to happen if the server in that split second after the request for the .htm file went down. Then the page would be displayed as is without the styles.i could be wrong but i think when your browser is downloading and it sees the <link rel="stylesheet"> it then downloads the stylesheet before continuing? like with <script src="somewhere_else.js">? so if that scenario did happen you'd have no page at all... if thats a worry though you could do with changing servers ;)

oracleguy
02-01-2003, 06:48 PM
Originally posted by hogtied

What were to happen if the server in that split second after the request for the .htm file went down. Then the page would be displayed as is without the styles. Or if the internet had some pretty bad lag, then the user would see the page as is then see it switch to the page that was meant to be seen with the styles.


The chances of that happening with the correct timing are almost impossible. Besides, I think redhead is correct.

And usually when you have an external style sheet, it isn't very big. I mean unless you have alot of CSS classes, your style sheet is probably >1KB. So that takes like no time at all to download.

hogtied
02-01-2003, 07:49 PM
Seem like you guys/girls have made your point above the "if the server went down" subject and yes I agree now.

Most of my web pages all have internal styles and I've been looking at those styles for redundance and figured that they would be best placed externally. And if a few pages required unique styles I could just make those internal or if other pages have those same unique styles I could make 2 stylesheets...

cg9com
02-04-2003, 07:03 AM
Originally posted by hogtied
And if a few pages required unique styles I could just make those internal
you can still make inline class="" specifications with an external sheet.

Kiwi
02-04-2003, 10:50 AM
External styles also force you to better design (increase seperation of presentation from content). This means that you are forced to make all of your pages more similar to one another -- which is generally a good idea if you want to create a coherent looking site.

brothercake
02-04-2003, 11:06 AM
A proportion of your visitors will (and all visitors can) view your page with no CSS - this has nothing to do with load synchronisation - you cannot prevent users from reformatting and seeing your page anyway they want. So although CSS allows you to determine how your page looks, it helps to divorce yourself from the idea that you can control this absolutely, but rather, see it like what you're doing is designing a "preset".

A well coded page should be perfectly useable without any CSS at all.