• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

How To Insert An Image In A Style Sheet?

 
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a style sheet called base.css and its content looks like:

How do I put an image goldbrush.gif in the
td.heading {
...
}
Thanks for your help.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
background: url("http://blahblahblah/yourimage.gif";)
 
JiaPei Jen
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the following code in my style sheet, the /PracticeVersion/article/assets/styles/base.css

and I have

in my /PracticeVersion/article/common/header.jsp
I am able to display everything but the image, "goldbrush.gif", that I intend to insert. What is wrong? Is it a path problem? Please help!
(In fact, I have tried to specify different paths. None of them works.)
 
Ranch Hand
Posts: 1061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
delete the quotation-mark in:
background: url(http://localhost:8080/PracticeVersion/article/assets/images/goldbrush.gif");
cb
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


http://www10.brinkster.com/A1ien51/Scripts/BacgroundGen.htm
[ October 17, 2003: Message edited by: Eric Pascarello ]
 
JiaPei Jen
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I followed all of your suggestions. With

in my .jsp, I have tried the followings in my base.css:
td.hr {
background: url("http://localhost:8080/PracticeVersion/article/assets/images/goldbrush.gif";);
}
and
td.hr {
background: url(http://localhost:8080/PracticeVersion/article/assets/images/goldbrush.gif);
}
and
td.hr {
background-image: url('http://localhost:8080/PracticeVersion/article/assets/images/goldbrush.gif');
}
The image simply does not show (everything else is displayed as expected). I have checked the folder that the image is located and the spelling of the image.
This image is somewhat thicker than a horizontal line. Should I specify the height and width for it?
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
did you try it without the hr? hr might be used in something else since it is a tag.....that might be your problem.
 
JiaPei Jen
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Becuase "hr" might be the problem, I replace "hr" with "bar"

I did the followings in my base.css:
td.bar {
background: url("http://localhost:8080/PracticeVersion/article/assets/images/goldbrush.gif";);
}
and
td.bar {
background: url(http://localhost:8080/PracticeVersion/article/assets/images/goldbrush.gif);
}
and
td.bar {
background-image: url('http://localhost:8080/PracticeVersion/article/assets/images/goldbrush.gif');
}
The image simply cannot be picked up. Can we really link to an image in a stylesheet?
 
Thank you my well lotioned goddess! Here, have my favorite tiny ad!
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic