How to access files from this hierarchy?

Tags: html,css,eclipse,jsp

Problem :

I need to access from the jsp files which are in WebContent/jsp folder, to the *.css file which is in WebContent/css.

And I've tried using link rel="stylesheet" type="text/css" href="../css/adminStyle.css". But, sometimes the *.css works and sometimes it doesn't.

Another thing is how do I access from a *.css file to an image in imgs folder. And I tried using background-image:url('../imgs/background.png');

The hierarchy is the following:


  +--->  adminStyle.css

  +--->  background.png

  +--->  admin.jsp

Solution :

"sometimes the css works and sometimes not" looks like you it works for some url and doesn't work for some url. for this @rickz answer will work


This will eliminate the possibility of breaking css import with regards of url

for second question "how do I access from a css file to an image in imgs folder"


because relative path of background image defined in css will start from the folder where your css file is.

    CSS Howto..

    How to use the float:left property in CSS without having the trouble I have?

    How do I repeat select elements in HTML

    Showing the percentage of poll's progress bar outside progress bar

    CSS: how do I force contents in a table cell to stay on one line when browser size reduced

    Basic concept for how javascript replaces an html input with something interactive?

    How to set the overall Grid thumbnail height to be equal?

    BackboneJS + HandlebarsJS - how to add image based on css

    How to recalculate css with jQuery window resize?

    .NET - How to build themes for big CSS files

    How to format my form with CSS?

    How to stop web content from being displayed before css/jquery is prepared?

    How to know the correct css selector or group of selector for any html element quickly?

    How to use a global parent selector with CSS Modules

    How to make css max width in IE6 and 7?

    How to place two section elements next to each other using CSS? [duplicate]

    How to force a browser to show the latest changes to a CSS file?

    Capybara/CSS: How to find an input field by label AND value?

    how do i css position this divs according to my layout picture?

    How to use cross domain dynamically generated CSS

    How to toggle two buttons on mouse hover?

    How to include php page which include also a css file?

    how can we use and control Gradient

    How do I center text relative to its parent div with CSS?

    how to blur the background image only in css

    How can I slide the sidebar out of view and make the content flexbox resize to fill the void?

    With Watin, how do I wait until an element gets a certain CSS class?

    How to trigger onClick event properly

    How can I center vertically a div with position absolute and hight = 100px on another div with position relative but with not standard height

    Hovering over a container div shows hidden div. When cursor is put over hidden div, behavior of container div changes

    How to make links one link per line, only in the footer via css?