I want to include a php script in a css file:
<?php
$str = "5px";
echo $str;
?>
and then
.header {
font-size: $str;
}
Is it possible?
I want to include a php script in a css file:
<?php
$str = "5px";
echo $str;
?>
and then
.header {
font-size: $str;
}
Is it possible?
No, not like that. CSS isn't a programming language, and has NOTHING to do with PHP.
You can, however, have PHP generate the CSS:
html:
<link rel="stylesheet" href="foo.php" ... />
foo.php
<?php
header('Content-type: text/css');
$str = '5px';
?>
.header {
font-size: '<?php echo $str; ?>';
}
Note that since you'r GENERATING css, you have to make absolutely SURE that whatever PHP outputs will be valid for the context the output is going into. It is very easy to output something that'll be a CSS syntax error and kill the rest of the CSS file.