Monday, January 23, 2017

USE PHP INSIDE CSS

filename : style.php
<?php 
header("Content-type: text/css");  
$color1 = "#000";
$color2 = "#fff";
?>
body {
    background-color: <?php echo $color1; ?>;
}
h1 {
    color: <?php echo $color2; ?>;
}
Include your dynamic css something like this:
filename : index.php

<link href="styles.php" media="screen" rel="stylesheet" type="text/css" />

No comments:

Post a Comment