Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

Thanks.

share|improve this question
add comment

1 Answer 1

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 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');
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
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 –  Anatoly Mironov Mar 11 '12 at 21:09
add comment

Your Answer

 
discard

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.