Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Struts and the fly likes Rendering images with CSS in struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Rendering images with CSS in struts" Watch "Rendering images with CSS in struts" New topic

Rendering images with CSS in struts

Aash Patel

Joined: Sep 14, 2005
Posts: 24
I am trying to render an image on a JSP page through CSS in a struts application.

This is what I'm trying to do:

width: 100%;
height: 50px;
background: #0066FF
url(/images/logo.gif) no-repeat center center;

<link href="CSS/styles.css" rel="stylesheet" type="text/css" />
<div id="topbar" />

The JSP reads the CSS file fine since all other formatting is acknowledged however the image for my top bar is not displayed. The background shows up fine. It seems like a context relative issue but I'm not sure how to resolve it. Any suggestions much appreciated.

Kerry Wilson
Ranch Hand

Joined: Oct 29, 2003
Posts: 254
You probably need to put your context path in the background-image url.
SCJP 1.4
I agree. Here's the link:
subject: Rendering images with CSS in struts
Similar Threads
centering inside div
IE Vs FirFox , image upload
Image URLs in CSS
Multiple bundles broke my app(properties file)