Cless Posted November 8, 2008 Share Posted November 8, 2008 My site allows users to edit the layout, and I store all of that in cookies. Now, I know you can mix CSS and PHP, however, as far as I know, you cannot use this code: <link rel="stylesheet" type="text/css" href="style.css" /> Seeing as my stylesheet is about a thousand lines long, that can be annoying. Typically, instead of storing it all in a .css file, I have to put it in a PHP/HTML file, such as: <style type="text/css"> .table { text-align: center; border: 1px solid black; font-size: <?PHP echo $table_font_size; ?>; } </style> If I saved that in a .php file, that would work, however it cannot be called upon using HTML, and would likely consume more bandwidth. If I saved it as a .css file, on the other hand, the PHP would not work. Basically; I needed to know whether or not it is possible to combine CSS and PHP without making the page source show the entire thing (or, in other words, use the link rel code). Thanks. Link to comment https://forums.phpfreaks.com/topic/131858-solved-php-css/ Share on other sites More sharing options...
DarkWater Posted November 8, 2008 Share Posted November 8, 2008 Add this line to the VERY top of the PHP file: header('Content-Type: text/css'); And then it should work just fine. Link to comment https://forums.phpfreaks.com/topic/131858-solved-php-css/#findComment-684972 Share on other sites More sharing options...
Cless Posted November 8, 2008 Author Share Posted November 8, 2008 It worked, thanks! Link to comment https://forums.phpfreaks.com/topic/131858-solved-php-css/#findComment-684995 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.