View Full Version : CSS - Separate files, or embedded?
aslefo
05-14-2001, 06:08 PM
A little question about stylesheets.
I have always had the css in separate files (.css)
I see that most put this code directly in the text. Why is that? Won't you get faster downloads since the .css caches? Browser differences?
COBOLdinosaur
05-14-2001, 06:14 PM
The best approach is to use .css files and link them in.
The use of inline styles should be limited to those cases where you need to override or enhance the standard style set in your sheet.
The reason you see a lot of styles inline is for the same reason you see depreciated tags being used. Lazy developers who don't care how many maintenance problems they cause as long as they can get page finished and go for a beer.
mike91
05-14-2001, 06:26 PM
Nice comment COBOLdinosaur
As an MD of a major web design agency based in Sussex I know the feeling - where poss use an external sheet - keep everything tidy as much as poss - all images in the image folders, and use as many index pages as poss.
Dr. Web
05-14-2001, 08:09 PM
though there are really three different styles... with three different outcomes.
linked.... your .css file which you link to, used to control the page layout in a general sense. Widely used to control large groups of pages, or whole sites.
embedded..... placed in the header, used to override/ compliment/ add to/ replace the linked (if any) style sheet. This may add any declarations not needed in the linked style sheet, or to specify changes needed on this page alone. This is useful if a certain page looks like the rest, with general differences.
inline..... placed in a specific line of code, will override both linked and embedded styles. Useful when a particular change is needed in one, or odd places in a page. For use when specific control over some element is desired.
Developers may use all three styles to control layout, while maintaining clean code.
JohnM
05-14-2001, 11:12 PM
Generally, when possible, I use the linked style that Doc mentioned. I find it much easier and you only have to write it once for multiple pages.
whkoh
05-15-2001, 12:09 AM
Of course. That is used for the general layout and style.
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.