Embedding PHP in CSS

by guruprasad 2014-05-05 11:03:52

To Embed PHP variables in CSS:

Add this code in a php file:
<?php
header("Content-type: text/css"); //setting header content.
$colorVal = 'red';
$hTagSize = '2em';
$hTagColor='blue';

?>
p
{
color: <?php echo $colorVal; ?>;
font-weight: bold;
font-size: 1.2em;
text-align: left; }
h1
{
color: <?php echo $hTagColor; ?>;
font-size:<?php echo $hTagSize; ?>;
text-align: centre;
}
550
like
0
dislike
0
mail
flag

You must LOGIN to add comments