Forum Moderators: not2easy

Message Too Old, No Replies

Defining a CSS Property with a Database

         

SeanF

9:26 pm on Dec 22, 2021 (gmt 0)

5+ Year Member Top Contributors Of The Month



I have a PHP/MySQL application where I would like the background and text colors to change depending on who logs in. The colors would be stored with the users' records in a database.

How can I read these variables from within the CSS file?

Thanks

robzilla

9:46 pm on Dec 22, 2021 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I would suggest using <style></style> and/or inline CSS to make those changes, rather than trying to dynamically insert the changes into the CSS file. The latter would require you to use a PHP script as your CSS file, or some variation of that, which is possible but computationally expensive compared to a static stylesheet file and probably unnecessary.