Background image location

I’m having problems getting a background image to load in rails.

In my public/images directory, I have a file rightimage.jpg.

In my stylesheet, I have an entry as follows:
td.rightcolumn {
background-image: url(/images/rightimage.jpg);
background-position: top left;
background-repeat: no-repeat;
}

In my layout, I have


 

The dummy space in the column will be replaced by text, so I can’t
simply use an <%= image-tag … %> entry - it’s going to have text over
it. On the background-image entry, I’ve tried url(images/rightimage.jpg)
and url(/images/rightimage.jpg). I can’t get the background image to
load on the page. I’m assuming that it’s because it’s not being found.

How do I get a background image to load in rails?

Thanks in advance.
—Michael

The dummy space in the column will be replaced by text, so I can’t
simply use an <%= image-tag … %> entry - it’s going to have text over
it. On the background-image entry, I’ve tried url(images/rightimage.jpg)
and url(/images/rightimage.jpg). I can’t get the background image to
load on the page. I’m assuming that it’s because it’s not being found.

How do I get a background image to load in rails?

Try:

background-image: url(…/images/rightimage.jpg);

Michael

Michael T. wrote:

background-image: url(…/images/rightimage.jpg);

Michael

I use this…

background-image: url("/images/watermark.jpg")

_Kevin

Michael T. wrote:

Try:

background-image: url(…/images/rightimage.jpg);

No good. Still doesn’t load.

—Michael

_Kevin wrote:

Michael T. wrote:

background-image: url(…/images/rightimage.jpg);

Michael

I use this…

background-image: url("/images/watermark.jpg")

The addition of quotes looked like something I’d miss, but it still
doesn’t load.

Thanks for trying
—Michael

Michael S. wrote:


Posted via http://www.ruby-forum.com/.

Try sticking the background-image on your body to see if it is really
loading or not.
There may be another reason it isn’t displaying.

_Kevin

Hi Michael,

I haven’t followed this back to the original post so forgive me if this
has
already been covered.

Are you able to load other images and only having problems with the
background images?

Best regards,
Bill

Try addeding explicit {height: xxx; width: xxxx} of the image to your
style

rightImage.jpg perhaps? Case issues on *nix systems.

Vish