Ive been trying to think of ways to dynamically change a style based off of input from a website back-end (through a language like PHP). Normally I have my stylesheets be separate CSS-extension files, but these won’t allow for PHP tags natively. It is, after all, extra markup in your HTML file than having all of your styles be in a separate file. Is the usage of the HTML <style> tag perhaps slower/less efficient than using a stylesheet?
Ive been trying to think of ways to dynamically change a style based off
Share
The W3C Recommendation for CSS 2.1 contains a section on Conformance: Requirements and Recommendations, which makes no reference to filename extension but does state:
Therefore, provided that the file is served with the
text/csscontent type (and that any cacheing concerns are addressed as mentioned in @Fluffeh’s answer), you should not have a problem. In PHP, the content type can be set with a call toheader()before any output is sent: