Jump to content

CSS with PHP


gple

Recommended Posts

i have a CSS file named style.php and in there I have this code

 

tr.prod {

font-size:12px;

font-family: tahoma;

color: green;

}

 

tr.prod1 {

font-size:<?=$font_size?>px;

font-family:<?=$font_pref?>;

color:green;

}

 

when i use tr.prod, the font styles and such come out properly.

when i use tr.prod1, the font-size and font-family do not work properly but the color does. any reason for this. when i output the style sheet in my browser i see the correct values in prod1

Link to comment
https://forums.phpfreaks.com/topic/228220-css-with-php/
Share on other sites

My guess is that he is calling the style.php file like this:

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

 

If so, then you have to input the correct headers within style.php to let the browser know that the data in the file is CSS and allow it to load properly, use the following header at the beginning of style.php if you are calling the way I expect you are.

 

<?PHP header("Content-type: text/css; charset: UTF-8"); ?>

 

Regards, PaulRyan.

 

Link to comment
https://forums.phpfreaks.com/topic/228220-css-with-php/#findComment-1177034
Share on other sites

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.