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.


1 Answer 1


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 http://contoso.com), 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');
  • Thanks!, it worked. Could you please explain a bit more why it worked, I'm not that good with css. Mar 11, 2012 at 10:19
  • 1
    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 Mar 11, 2012 at 21:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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