In the code above, I can change the width of div by changing the $widthVariable.Code:<?php $widthVariable=200; ?> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <link href="widthVariable.css" rel="stylesheet" type="text/css"> <title>widthVariable</title> <style type="text/css"> .widthVariable {width:<?php echo $widthVariable ?>px;background-color:yellow} </style> </head> <body> <div class="widthVariable"> myDiv </div> </body> </html>
I like to remove the part below in the page above.
Instead of removing the code abvoe, I like to put the code below into the widthVariable.css.Code:<style type="text/css"> .widthVariable {width:<?php echo $widthVariable ?>px;background-color:yellow} </style>
But the green part of the code in widthVariable.css doesn't work because it's PHP code in css file.Code:.widthVariable {width:<?php echo $widthVariable ?>px;background-color:yellow}
Is there any way to make php code in a css file do work ?



Reply With Quote





Bookmarks