[Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 318
  • Last Modified:

Links to dynamically created (via ColdFusion) CSS

I would like to link to a dynamic style sheet created in CF (<link href="CSS.cfm" rel="stylesheet" type="text/css">) (it is being linked on a CF page). I've added <cfcontent type="text/css; charset=ISO-8859-1"> to the css.cfm and the page displays correctly in in IE, Firefox and Netscape, but the stylesheet isn't applied in Opera.

  <cfcontent type="text/css; charset=ISO-8859-1">
 <cfquery name="userSettings" datasource="barney">
     SELECT * FROM userSettings WHERE user=#authenicatedUserID#
<style type="text/css">
     .NormalText {  font-family: <cfoutput>#userSettings.normalFont#</cfoutput>;}

I can make it work in all browsers, by using a cfinclude, but I would prefer to link to the dynamically generated CSS.

How can I get this to work w/ Opera (while still working in IE, Firefox and Netscape) using the link implementation?
  • 2
1 Solution
> I would prefer to link to the dynamically generated CSS.
Are you sure about that?
If you need to dynamically generate the CSS, it might be better to just nest it inside your page.
Using a linked CSS is good because the client just needs to download it once.
But it it's dynamically generated, i don't see the point.
LERNWebmasterAuthor Commented:
I would like to re-use the styles in multiple pages, thus using a linked css would allow me to make changes to the one file (it is not 100% dynamic) and have those changes reflected sitewide.  Turns out I had some ColdFusion stuff after setting the contenttype, I moved that to before the <cfcontent> and all is well.
i'm happy you found a solution.  thanks for the points.

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now