Forum Moderators: not2easy
I know a link to a CSS sheet is easier (uness you use a UNIX build method as I do...with a template) but what is your feelings?
I've always read and understood that the less code and more content on a page is better for the engines. So, my vote would be to keep it off the page and link to it...
Any thoughts?
We use a UNIX type of "build page". It simply takes a template (usually I call it template.html) and then inside the body of the template I use a #body# tag which when the UNIX command is typed...it will insert a .txt file (with the individual page content) into the place on the template where #BODY# is and meshes it together and wallla...you have a new page. It uploads the page on the server also when you type the "make" command. So... either way to use CSS really doesn't matter in my case since I just have to modify the CSS in the <head> of my template once. One of our sites you can see this example of the template is intelliscribe.net. If you look at the source, from <--BODY CONTENT START--> to <--BODY CONTENT END--> is filled in by a .txt file that I have in the same folder. Everything above and below this two comments is the template...
Thank you for the reply!
Styles that get used many times get put in an external stylesheet.
Styles that you know will only ever apply to one page get put in the head of that page.
Styles that you know are only ever used once get put in-line in the tag.
It's basically the same principle as considering scope when declaring variables in common programming laguages (VB, Java, many others).
Global vs. Modular vs. Local.
For example:
<link href="fat.css" title="Fat Look" rel="stylesheet" type="text/css"/>
<link href="skinny.css" title="Skinny Look" rel="alternate stylesheet" type="text/css"/>
On a supported browser the user will be able to choose between "Fat Look" and "Skinny Look" at their leisure.
Jordan
I've been experimenting with multiple style sheets (instead of just one big one) with my latest project. The difference is that I've still put the page specific CSS goes into a separate .css file that is imported for that page only. You don't get any cache benefit, since it's just for a single page, but the SEO benefit is still there.
Also by linking the one sheet before importing the second it stops that awful flash of the unformatted page. If you are always on a fast connection you may not be aware that this occurs.
The separate style sheet of sheets make it possible to easily change the look of the whole site . That's the #1 advantage for me.
I've been experimenting with multiple style sheets (instead of just one big one) with my latest project. The difference is that I've still put the page specific CSS goes into a separate .css file that is imported for that page only. You don't get any cache benefit, since it's just for a single page, but the SEO benefit is still there.
I recently had another idea: to put all the positioning styles in one .css file, and to put all the text formatting styles in another. There's no advantage from a code point of view, it just makes sense to organise files in a way that groups the styles by what they do.
I've been considering something like that, because I feel so inhibited by cross-browser complications that I often keep my CSS pretty basic.
Yes, code-to-content ratio is improved, but you also get the good content closer to the top of the code, which I believe also helps with SEO.
I'm starting to think that I need to approach my current project with multiple sheets as you mentioned. My "client" seems more concerned with the colors of the site than the content or positioning. That has made me consider pulling all color attributes out into a separate sheet so that it will be easier to catch them all when it comes time for another change.
And as I look at that I wonder if postioning should come out as well, so that a rearrangement of the site won't involve searching through a large .css file (I've carefully labeled my divs to facilitate future finagling, in the manner of the CSS Zen Garden).
It's starting to make sense to me that, for large projects, I should keep three .css files: one for color, one for positioning, and one for everything else (or is there another subgroup I'm missing?). Then of course there could be other files for specific (groups of) pages.
There could be a slight size hit initially as some items could be repeated three time. For example,
#thisdivid a:hover could be repeated once in each stylesheet, adding an extra 40 or so bytes to the initial download. I don't think that should be much of an issue though, especially since it would be a one-time penalty with caching.