开发者

Variables in CSS / Codeigniter?

Hey, I'm trying to set variables in my CSS so that I can allow subscribers to customize the colors 开发者_StackOverflowof their page. I'd rather have as many files on my static server as possibly.

Is there a good / easy way to do this? Should I just have a CSS file containing all the editable parameters in a CSS file inside the application?

Walker


There are a few different ways you could do this:

  1. Use PHP to output your CSS file that contains all the editable CSS values (make sure you remember to set the mime type of the file to text/css).
  2. Alternatively, you could tell the web server to parse CSS files for PHP code (Apache in the example below).

This goes in your site's .htaccess file (tells the server to look for PHP in CSS files):

AddType application/x-httpd-php .css

This goes at the very top of your CSS file so browsers treat it as a CSS file:

<?php Header ("Content-type: text/css");?>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜