Image path within theme CSS
Permalink
Hello,
I’ve made a really simple theme, called 'abc'. I’ve copied the following files to my site:
The default.php file contains the lines in the <head>:
The main.css file contains:
The problem is, when I view the site, the image cannot be found. The corresponding line in the generated CSS is:
Which looks right, but gives a 404.
I’m wondering whether this could be something to do with pretty URLs (which I have turned on) intercepting the URL of the image?
I’m not sure if it’s relevant, but the generated URL of the CSS file is:
I’ve made a really simple theme, called 'abc'. I’ve copied the following files to my site:
themes\theme_abc\default.php themes\theme_abc\description.txt themes\theme_abc\images\img.jpg themes\theme_abc\main.css themes\theme_abc\typography.css
The default.php file contains the lines in the <head>:
The main.css file contains:
body { background: url(images/img.jpg) repeat; }
The problem is, when I view the site, the image cannot be found. The corresponding line in the generated CSS is:
background: url(http://www.my-domain.co.uk/themes/theme_abc/images/img.jpg) repeat;
Which looks right, but gives a 404.
I’m wondering whether this could be something to do with pretty URLs (which I have turned on) intercepting the URL of the image?
I’m not sure if it’s relevant, but the generated URL of the CSS file is:
http://www.my-domain.co.uk/index.php/tools/css/themes/theme_abc/main.css
My stylesheet call is slightly different:
Generated link is fine because you used 'getStyleSheet' as opposed to 'getThemePath'
Check your paths and asset placement again just to be sure everything is ok.