Another big problem I have with css is image paths.
Let's say you have this:
Quote:
#header {
background-image:url("bg.jpg");
}
|
No problem there, unless you have your .css file in a folder such as /css/. So you change it to this:
Quote:
#header {
background-image:url("/bg.jpg");
}
|
That will jump out of the /css/ folder and back into the main folder where the image is. But if your site isn't in the home directory (site.com/) because you're using a sub domain or something then this isn't going to work. So you specify the path:
Quote:
#header {
background-image:url("/subdir/bg.jpg");
}
|
OR
Quote:
#header {
background-image:url("http://www.site.com/subdir/bg.jpg");
}
|
It works again. But this dangerous because if you ever wanted to move the site or copy this layout for use on another site (such as is done in a script) you would have to go through the .css file and replace all kinds of paths! Unacceptable.
This is one of the areas I think the whole CSS layout thing fails, if the layout were done in Tables then you could easily have the sites URL placed into a PHP variable and then when you move the site you simply change this variable and all of the images will still work.
Example:
Quote:
<?php
$site_url = "http://www.site.com/subdir";
?>
<table>
<tr>
<td style="background-image:url(<?=$site_url?>/bg.jpg);">blah</td>
</tr>
</table>
|