Change css value with php

后端 未结 3 1796
天命终不由人
天命终不由人 2021-01-03 03:19

how can I change css of a div displaying some text on my home page from the admin are. I want when I enter a color code in my plugin admin page, the code is updated in the c

3条回答
  •  庸人自扰
    2021-01-03 04:10

    You should actually not use a .css file and instead use a .php file acting as a .css file. Then you can just set the new color to a variable in the .php css file.

    Rename your style.css file to style.php, then add the following to the top of the file:

    
    

    This line tells the browser that the file is CSS instead of HTML. In your HTML files, change the stylesheet references from style.css to style.php. For example:

    
    

    citation: http://www.barelyfitz.com/projects/csscolor/

提交回复
热议问题