SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an image that is located at the root Style Library site. I want to put that image in the MasterPage. Using SharePoint Designer, I get this reference background-image:url('../../../../Style Library/banner/Middle.png');The link is working fine for the root site and its sub-sites. But as soon as I open a site in the sub-site, the image is not displaying anymore. I;m using SharePoint 2010 Foundation. how do I fix this.


share|improve this question
up vote 4 down vote accepted

If the users has access to the root site, use the root relative site url. If the root site is located under the "slash" (like http://intranet/ or, so you can refer to the image directly using slash in front of the url, called root-relative url

background-image:url('/Style Library/banner/Middle.png');
share|improve this answer
Thanks!, it worked. Could you please explain a bit more why it worked, I'm not that good with css. – Agamand The True Mar 11 '12 at 10:19
It is not the matter of CSS (neither of SharePoint). You can use absolute urls ('http://contoso/Style Library/banner/Middle.png'), or relative ('../../../Style Library/banner/Middle.png') or "root-relative": ('/Style Library/banner/Middle.png'). See a simple intro these three url types – Anatoly Mironov Mar 11 '12 at 21:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.