gple Posted February 19, 2011 Share Posted February 19, 2011 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 Quote Link to comment Share on other sites More sharing options...
gple Posted February 19, 2011 Author Share Posted February 19, 2011 only when i define a variable (ie $color="green") does it output the proper code. when i run a query and map a result to a variable that doesnt work (ie $color=mysql_result(...). BUt when I output the file, i see the results both appear properly. Quote Link to comment Share on other sites More sharing options...
ejscottb Posted February 20, 2011 Share Posted February 20, 2011 I think you have to use escape characters when using numbers naming classes in CSS. Numbers can give problems depending on your page code. Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted February 20, 2011 Share Posted February 20, 2011 Please post more of your code between tags. Ken Quote Link to comment Share on other sites More sharing options...
PaulRyan Posted February 20, 2011 Share Posted February 20, 2011 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.