There are many reasons why you want to keep the CSS in a separate file. The benefits are clear, easier to manage, easier to apply to multiple pages, cacheable, etc.
Recently, we redid our Hansgrohe page. See the left side column with all the categories? The width of that column changes depending on whether you're viewing the main Hansgrohe page, or a category page. Because the style is exactly the same and the only difference is the width, I didn't want to create another stylesheet just for the category page.
Instead, I made the CSS page a ColdFusion page, and I pass along a flag to indicate what the width should be. There is one <cfif> tag looking at that flag and setting the appropriate width. The resulting CSS is the exact same, just the URL now ends in ".cfm" instead of ".css".
In IE, everything is wonderful. It parses the file and applies the styles. In FireFox, not so good. No good at all. It refuses to look at the file as a stylesheet.
The solution is to tell FireFox that it's a CSS file. You do this by adding this line of code:
<cfcontent type="text/css" >
Thats all. You can translate that line to the language of your choice.
Item of the Day: Iperbole Monoblock 5131.101 - Bathroom Faucets by Porcher
Comments