Sunday, May 31, 2009

CSS background images & Rails

Setting a CSS background image in Rails have one quirk, when using a relative url, the base directory is not the base directory of the project. It's the directory where the stylesheet CSS file lives. So the correct relative url is this;

#wrapper1 {
background: url(../images/background.gif) repeat left top;
}

when the image & stylesheet live in the usual places.

Gnoll110