I’m new to ModX and using the CSS as documents and I can get everything to work except for the background images in the CSS document. No matter what I enter as the URL it will not display the images. I created a folder in the root and assets directories that contain my images.
First I used backgound: url(assets/css/mycss/image.jpg) but no go.
I also used url(css/mycss/image.jpg) and such.
This is driving me up the wall. I search the forum and couldn’t find anything on this. What am I doing wrong?
Just because I don't know what I'm doing, it has never stopped my from breaking something.
-
MODX Staff
- 730 Posts
Hi rcpettit,
Is the CSS document you’re referencing in the root level of your site?
Images in CSS are always referenced relative to the CSS document itself, not the document that uses the CSS file.
I followed the file structure that the CSS as document instructions said to use.
assets/css/mycss but this didn’t works so i made a
css/mycss in the modx root directory but still no luck.
Just because I don't know what I'm doing, it has never stopped my from breaking something.
-
☆ A M B ☆
- 24,524 Posts
Try
url([(base_url)]assets/css/mycss/image.jpg
I tried that but it didn’t work. I also tried
in the template:
<base href="[(site_url)]" />
and in the css document I used
#header {
background: url([(site_url)]/css/mycss/image.jpg)
}
But that didn’t work either.
Just because I don't know what I'm doing, it has never stopped my from breaking something.
-
☆ A M B ☆
- 24,524 Posts
Look in the page source and make sure that the URL being generated is the one you want. Can you provide a link?
Sorry took so long to get back. Fixed the problem by reinstalling modx. Now everything works fine.
Just because I don't know what I'm doing, it has never stopped my from breaking something.