# Revision: Background image contained in stylesheet

**URL:** <https://www.ruby-forum.com/t/revision-background-image-contained-in-stylesheet/165613>\
**Category:** Rails\
**Created:** [April 15, 2009, 6:32pm UTC](https://www.ruby-forum.com/t/revision-background-image-contained-in-stylesheet/165613 "2009-04-15T18:32:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rubio](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/a88e4f/32.png) [@rubio](https://www.ruby-forum.com/u/rubio)\
**Post date:** [April 15, 2009, 6:32pm UTC](https://www.ruby-forum.com/t/revision-background-image-contained-in-stylesheet/165613/1 "2009-04-15T18:32:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rubio](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/a88e4f/32.png) [@rubio](https://www.ruby-forum.com/u/rubio)\
**Post date:** [April 15, 2009, 6:39pm UTC](https://www.ruby-forum.com/t/revision-background-image-contained-in-stylesheet/165613/2 "2009-04-15T18:39:43Z")

</div>

On Wed, Apr 15, 2009 at 9:32 AM, Rob B. \<  
removed\_email\_address@domain.invalid\> 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/](http://www.ruby-forum.com/).
> 
> >

–  
Robby R.  
Chief Evangelist, Partner

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

> **[Planet Argon](https://www.planetargon.com/)**
>
> Planet Argon is a Ruby on Rails development agency specializing in maintenance and support for existing Rails apps. Based in Portland, OR, Planet Argon has been a member of the Rails community since 2004.

[http://robbyonrails.com/](http://robbyonrails.com/)  
[http://twitter.com/planetargon](http://twitter.com/planetargon)  
aim: planetargon

+1 503 445 2457  
+1 877 55 ARGON [toll free]  
+1 815 642 4068 [fax]

---

<div class="post-metadata">

**Author:** ![rubio](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/a88e4f/32.png) [@rubio](https://www.ruby-forum.com/u/rubio)\
**Post date:** [April 15, 2009, 7:47pm UTC](https://www.ruby-forum.com/t/revision-background-image-contained-in-stylesheet/165613/3 "2009-04-15T19:47:49Z")

</div>

Robby R. wrote:

> On Wed, Apr 15, 2009 at 9:32 AM, Rob B. \<  
> removed\_email\_address@domain.invalid\> 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/](http://www.ruby-forum.com/).

> –  
> Robby R.  
> 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 !
