The easiest way is just to put all your images files in one folder. For simple sites I organize things like this:
Code:
- Base folder with HTML/PHP files
- CSS folder with stylesheets
- Image folder
- JavaScript folder
- PDF folder (if needed)
That way all the images are in one place and it simplifies filepaths.
To specify a filepath other than the folder the stylesheet is in, go like this. To go up one level:
Code:
background-image:url("images/image1.jpg");
To go down one level:
Code:
background-image:url("../image1.jpg");
To go down two levels:
Code:
background-image:url("../../image1.jpg");
To go down one level and then back up one level (into the folder "images"):
Code:
background-image:url("../images/image1.jpg");
It's complicated I know. If all else fails you can always specify the full filepath:
Code:
background-image:url("http://www.yoursite.com/site/images/image1.jpg");