Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9076889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T19:12:29+00:00 2026-06-16T19:12:29+00:00

In my view I can load a image with this line of code: <div

  • 0

In my view I can load a image with this line of code: <div id="bglion"><%= image_tag("BG-LION6.png")%></div> (this works), but instead I want to load the image from the CSS file.

After reading arround, I have tried this:

#bglion {src: background:url('BG-LION6.png');}
#bglion {src: asset-url('BG-LION6.png');}
#bglion {src: asset-url('BG-LION6.png', image);}

…but the picture won’t load on the page.
How can I make it work?

(The image is in /assets/images)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T19:12:30+00:00Added an answer on June 16, 2026 at 7:12 pm

    I think you’ll have to do a couple of things. Your CSS should probably be something more along the lines of this:

    #bglion { background: image-url('BG-LION6.PNG'); }
    

    background is the CSS property you’re actually trying to set. src is not a CSS property. image-url is a Rails path helper that points to your image assets folder. I believe if you just use asset-url it points to your entire assets folder and you would still have to specify that your image is in the images folder.

    Secondly, if your div no longer contains an image within it, it will collapse to a width and height of 0 cause there’s nothing to define its dimensions. You’ll have to add more CSS to the wrapper div to define the dimensions of the image. So something like this:

    #bglion { background: image-url('BG-LION6.PNG'); width: 100px; height: 100px; }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can i dynamically load a Partial View? I mean I have this view,
you can view full source code here dpaste.com/hold/167199 Error: delete() takes exactly 2 arguments
How can view the execution line used by netbean v6.8 to execute my java
I'm working on an image viewer application (OSX) and currently it can load and
In following code i has error in view, how can fix it? My data
I know that a view can only be a subview of one superview, so
Quick question regarding delegateEvents in a View - can we specify multiple event bindings
Is there an easy way to limit the number of times a view can
I am working on QuickDialog at here However, my view can not scroll and
You can view my site here - http://patiss-themes.com/planetary/ and as you can see on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.