|
-
Jan 26th, 2003, 08:22 AM
#1
Usage of CSS file
To what extent should an external CSS file be used? If it's possible to specify just about every attribute required on the page in that CSS file, is it advisable?
And what if the CSS file grows to be too large? How large is considered 'too large', btw?
-
Jan 26th, 2003, 09:14 AM
#2
Hyperactive Member
As far as I know CSS can only be used for Format and lay-out.
Not the text itself.
CSS however is advisible. I always put about everything in my CSS-file. The file can be as big as you want. But keep in mind, the user will have to wait till the file is downloaded when he visits your site. So don't make it like 2 MB
If you also want to specify your text in an external file I suggest you use (CGI) SSI. It's very easy. (It's also known as SHTML.) But your webserver will have to support it.
<!--#if expr="${HTTP_USER_AGENT} = /MSIE/" -->
<!--#include file="file1.txt" -->
<!--#else -->
<!--#include file="file2.txt" -->
<!--#endif -->
this is a very nice example of SSI. I don't think I have to tell you how it works. The commands speak for themselves. 
If you don't like SSI, you can always try PHP or ASP ... ASP is my favourite. It works fine with Access or SQL server, etc ... (However, it sometimes creates conflicts when using both CSS and ASP-forms in the same file.)
Enjoy.
____________________________________________
Please rate my messages. Thank you!
____________________________________________
Bram Vandenbon
http://www.bramvandenbon.com
-
Jan 26th, 2003, 10:34 AM
#3
That would obviously require CGI support, wouldn't it?
Code:
<link rel="stylesheet" type="text/css" href="quack.css">
Shouldn't this be the 'proper' way?
-
Jan 27th, 2003, 06:09 AM
#4
Frenzied Member
Yep that's the proper way. I would definately advise using CSS totally externally, there are a few benifits:
- If you want to change the layout you only have to change the one CSS file, not the HTML pages
- Quicker downloads as browsers cache CSS files
- People with really old browsers will have even quicker downloads as they don't even get it (very few of these about any more anyway, but text-browsers for example would benifit)
- Makes for better accessibility
- A lot of the older methods (like font) are either deprecated or removed in newer standards.
probably a bunch more too Plus you can make media dependant style sheets (e.g. screen, print, teletype, etc), so only the right ones will be downloaded, and you can have your page formatted different for different mediums. My site is totally external CSS by the way.
-
Jan 27th, 2003, 11:52 AM
#5
Black Cat
There's also an @import way of using an external file.
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
-
Jan 27th, 2003, 01:15 PM
#6
Hyperactive Member
yep here's the syntax of the import !
@import "mystyle.css";
or
@import url("mystyle.css");
or
@import url(mystyle.css);
The 'LINK' element references alternative style sheets that the reader can select, while imported style sheets are automatically merged with the rest of the style sheet.
http://www.w3.org/TR/REC-CSS1
____________________________________________
Please rate my messages. Thank you!
____________________________________________
Bram Vandenbon
http://www.bramvandenbon.com
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|