Forum: Ruby on Rails Using public images in css?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
17fefeb3c1832175bf6fbe9841368292?d=identicon&s=25 mbonig (Guest)
on 2005-12-04 21:57
(Received via mailing list)
I am trying to make a .rhtml that has a div tag in it. That div tag has
a
background image that is physically sitting in the public/images
directory.
This is the CSS I have:

{
	position: relative;
	background-image: url(/images/todo_border.jpg);
	width: 420px;
	height: 280px;
}

but it doesn't display the background. I've verified that if I view:

http://localhost:3000/images/todo_border.jpg

I can see the picture. But it doesn't seem to work in the css file.

any ideas?
thanks,
M
2dd904ec5981c31e7bb7a5743a53caf8?d=identicon&s=25 Bruce Balmer (brucebalmer)
on 2005-12-04 22:18
(Received via mailing list)
M:

Are you missing some quotes around the rule ie. "/images/
todo_border.jpg"?

  Don't really know if that is the right answer, just hazarding a guess.

bruce
E93ace22ca8642bb732b05f796abd5c5?d=identicon&s=25 dteare (Guest)
on 2005-12-04 22:47
(Received via mailing list)
It should be okay without the quotes.  Here's the css rule I use
which works in FF and IE:

.email {
     background: white url(/images/envelope.gif) no-repeat top right;
}

Start with my working code and work towards yours.  Make sure your
selector is correct - set the text color to red or something to
ensure the right css rules are being grabbed.

HTH,
--Dave.
This topic is locked and can not be replied to.