Dynamic CSS without using JavaScript
Let’s say you want some dynamic graphics on your website, but you don’t want to, or don’t know how to use JavaScript.
Well PHP might be the answer. The first thing I thought was, ‘How do a I get PHP into my CSS File?’. Well you don’t!
Inline CSS - most people hate it, but in this case, it can be useful.
<style>
#testdiv {
height: 50px;
background-color: red;
<?php
echo “width: ” . 250 . “px;”
}
</style>
Stick that in your <head></head> tags, and PHP will write the width command for you! Now this is a very, very simple example, but use your imagination, and you’d be surprised what you can do!