Forum: Ruby on Rails Revision: Background image contained in stylesheet

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.
F6715491a2224a42bd2a0d6e290b14ce?d=identicon&s=25 Rubio Ramirez (rubio)
on 2009-04-15 18:32
I realized that I should have included a bit more information in my
previous post, so here's the revision.

application.html.erb is correctly finding the stylesheet for my project
via <%= stylesheet_link_tag 'style1' %>.  My webpages reflect the
styling properly with a few exceptions .. the most notable being some
.jpg images defined for background do not display at all.  I have those
images in public/images.

The following is the stylesheet code containing the reference to the
image.

#navigation {
  width: 180px;
  height: 484px;
  background: #7da5a8 url(nav-bg.jpg) no-repeat;
}

I tried the absolute path to the image above per: background: #7da5a8
url(C:\InstantRails\rails_apps\getdowninthevalley\public\images\nav-bg.jpg)
no-repeat; but that didn't work either

This worked fine until I retrofitted the webpages into the Rails
framework (which I really like, but which I'm relative new to).

If anyone knows the solution, I would really appreciate it ... thanks in
advance!

Rubio
A82ba1167f4d4a8d1de63820e576a87f?d=identicon&s=25 Robby Russell (Guest)
on 2009-04-15 18:39
(Received via mailing list)
On Wed, Apr 15, 2009 at 9:32 AM, Rob Blimploid <
rails-mailing-list@andreas-s.net> wrote:

> The following is the stylesheet code containing the reference to the
> image.
>
> #navigation {
>  width: 180px;
>  height: 484px;
>  background: #7da5a8 url(nav-bg.jpg) no-repeat;
> }
>

Your path needs to specify the full relative path.

url(/images/nav-bg.jpg)

Looks like you're missing 'images/'


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


--
Robby Russell
Chief Evangelist, Partner

PLANET ARGON, LLC
design // development // hosting w/Ruby on Rails

http://planetargon.com/
http://robbyonrails.com/
http://twitter.com/planetargon
aim: planetargon

+1 503 445 2457
+1 877 55 ARGON [toll free]
+1 815 642 4068 [fax]
F6715491a2224a42bd2a0d6e290b14ce?d=identicon&s=25 Rubio Ramirez (rubio)
on 2009-04-15 19:47
Robby Russell wrote:
> On Wed, Apr 15, 2009 at 9:32 AM, Rob Blimploid <
> rails-mailing-list@andreas-s.net> wrote:
>
>> The following is the stylesheet code containing the reference to the
>> image.
>>
>> #navigation {
>>  width: 180px;
>>  height: 484px;
>>  background: #7da5a8 url(nav-bg.jpg) no-repeat;
>> }
>>
>
> Your path needs to specify the full relative path.
>
> url(/images/nav-bg.jpg)
>
> Looks like you're missing 'images/'
>
>
>>
>> Rubio
>> --
>> Posted via http://www.ruby-forum.com/.

> --
> Robby Russell
> Chief Evangelist, Partner
>
> PLANET ARGON, LLC
> design // development // hosting w/Ruby on Rails


Thanks for the reply .. I changed it to:  url(../images/nav-bg.jpg) and
it now works beautifully.  Thanks for taking the time to address this
problem !
This topic is locked and can not be replied to.