on 08-17-2008 5:04 PM
Hi Everybody,
how can i reference a image in css? Until now i used the following piece of code which only works if i put the css inside my jsp file. What could be the reason. When i put the css part in a seperate file the images are not referenced.
index.jsp:
<% String mimeUrl = componentRequest.getWebResourcePath(); %>
<link rel="stylesheet" href='<%=mimeUrl+"/css/myStyle.css"%>' type="text/css" />
<ul class="glossymenu">
<li><a href="http://www.dynamicdrive.com/style/"><b>CSS</b></a></li>
<li><a href="http://www.dynamicdrive.com/forums/"><b>Forums</b></a></li>
</ul>
myStyle.css:
<style>
.glossymenu{
position: relative;
padding: 0 0 0 34px;
margin: 0 auto 0 auto;
background: url(<%=mimeUrl%>/images/menub_bg.gif) repeat-x;
height: 46px;
list-style: none;
}
....
</style>
regards,
Seed
Hello,
because files ending with .css are usally not processed by the jsp processor - so <% .... %> stays in ans <% ... %> (just try to open the css in your browser)
one way is to rename your .css files to jsp or tell the application server to process .css files like .jsp files
regards
franz
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.