Jump to content

Is there any way to use PHP in CSS files?


Orionsbelter

Recommended Posts

Is there any way to use PHP in a CSS file?, or to use a database with a CSS file for example if i want to save the name of a color I.E blue in a database field then print it into a CSS file so i can change this easily when ever i want.

 

 

Thank you for looking.

Well simplest example is for you to just take your current css file and change its extension to .php and add

 

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

 

To the beginning of it. Then change the html that calls it reflect the new file name.

<link rel="stylesheet" type="text/css"
media="screen" href="style.php">

 

Once youve done that you can add whatever else you want in the new file.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.