phppaper Posted March 25, 2008 Share Posted March 25, 2008 Hi Is it possible to put css into php code and save it as a php file?? Link to comment https://forums.phpfreaks.com/topic/97721-css-into-php-code/ Share on other sites More sharing options...
cooldude832 Posted March 25, 2008 Share Posted March 25, 2008 sure but why? I can write pink ponies a million times and put it in a .zqw file but is there a point? Link to comment https://forums.phpfreaks.com/topic/97721-css-into-php-code/#findComment-500047 Share on other sites More sharing options...
rhodesa Posted March 25, 2008 Share Posted March 25, 2008 Sometimes there are reasons for having CSS in a php file, like the CSS is stored in a database table. What you want to do is put a header() call at the top: <?php header('Content-type: text/css;'); echo 'h2 {color: #FF0000;}'; ?> /* Here is more static stuff */ h3 {font-size: 10pt;} Then reference it from an HTML page just like a normal CSS file (but the URL will be to styles.php instead) Link to comment https://forums.phpfreaks.com/topic/97721-css-into-php-code/#findComment-500081 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.