Images in CSS

Permalink
Hey,

I have one site which in the CSS references images (background etc), how do i ensure that they are found when the page is loading because currently they aren't, and using:

<?=$this->getThemePath()?>

doesn't work!

Thanks

 
Maynar replied on at Permalink Reply
Maynar
In the "default" theme (concrete/themes/default/images/) it just points to images/ in the css. Which in turn points to the subdirectory concrete/themes/default/images/.

I'm not sure how they managed to do this, but it appears to be working for that one so you could give it a try.
andrewgalpin replied on at Permalink Reply
Nope, having no luck with that :S

Any other ideas?

Thanks
jgarcia replied on at Permalink Reply
jgarcia
you could try that line with the echo in it, rather than just the "=", as I think some php configs might not allow that.

<?php echo $this->getThemePath(); ?>

that should work. if not, can you send a link?
jgarcia replied on at Permalink Reply
jgarcia
are you referring to putting that code in the css file? in that case, you would put the image url in relation to the css file. in other words, if you have a "css" folder in your theme where the css file is location, and you also have an "images" folder, you would need to specify the path as '../images/file.jpg' from the css file in order to reference a file in the images folder.
andrewgalpin replied on at Permalink Reply
Yes i need to put the code in the CSS,

http://74.52.183.82/~armanwad/concrete5/themes/hhoe/...

that's a link to all the template files,

Thanks

Andy
jgarcia replied on at Permalink Reply
jgarcia
just start the image url with 'images/...'.

you don't need the ../ since your css file is in the root of your theme directory. in other words, it should look like this:

#main
{ background: #FFFFFF url(images/back.png) repeat-y;
  color: #5A6370;
}
andrewgalpin replied on at Permalink Reply
Brilliant that's sorted it, sorry my CSS isn't great!

Thanks

Andy