/ Published in: PHP
dynamic CSS file, where the background style attributes (in this case h2 headers) are auto-created from the files in a particular directory.
- include the css file as per normal in your
- create new css.php file
- add in custom css header - header("Content-type: text/css");
- create directory full of heading images
- add in code below
- will automatically set the background image of "some-header.png" from the image directory
- win life!
Expand |
Embed | Plain Text
/* all your other CSS rules can go here too! */ h2 { display:block; width:400px; height:30px; background-repeat:no-repeat; } h2 span { display:none; } <? $path = 'headers/'; $dir = $_SERVER['DOCUMENT_ROOT'] . $path; if ($file != "." && $file != "..") { } } } ?>
You need to login to post a comment.
