Sign up ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I was hoping someone may be able to guide me in the right direction. I want the header in a custom master page to have a background image that can be changed by an 'owner' in a user friendly manner.

The image(s) will be stored in a picture library on the root site and the master page is applied to all sites and sub-sites.

I had an idea whilst writing this post of using the logo URL option in the settings of the site.

Does anyone have any suggestions as to how I can achieve this?

Thanks in advance,

share|improve this question
Thanks for the suggestions so far. Both idea's are great but are require a user editing a CSS file to apply a different banner. I was hoping to find a more user friendly or content manageable solution like the logo URL option in the settings of the site. – James Callaghan Jun 27 '12 at 15:30
Perhaps a custom solution that will manage a setting value and store it in the site property bag that I access within the master page like the site name etc. – James Callaghan Jun 27 '12 at 15:31
James, the solution I provided does not involve the user to modify anything in the css. Its a onetime filename entry by the designer and every subsequent updates can be made the owner. It means owner can upload the banner on the picture library and it appears on the masterpage automatically without any involvement of the designer or the owner to modify any css file. All it requires is the filename of the banner should be same as defined in the css style. – Arko D Jun 28 '12 at 10:53

4 Answers 4

I know it's been a few years, but I found a good solution to this. You have them insert a normal image into a containing div, and then you use this jquery:

$(function() {
    $(".header_image img").each(function(i, elem) {
      var img = $(elem);
      var div = $("<div />").css({
        background: "url(" + img.attr("src") + ") no-repeat",
        width: img.width() + "px",
        height: img.height() + "px"




$(function() {


The first function takes an image that's inside of my .header_image div and applies a bunch of css styles to it to make it a background image. Then it adds the class .replacedImage to it and then it changes the img tag to a div.

After this runs, the second function puts another div inside of that replaced image div (which in my case was .header_info).

So now anytime someone uploads an image to the ".header_image" div, it will turn it into a background image and wrap that div around my header info. Hope this helps anyone in the future! Here are the sources i've found that lead me to be able to do this:

Turn image src into background image: image src to background image

How to move an element into another element:move element

share|improve this answer

I think this may be a good question. I've personally used the CSS method, similar to the other answers. You could do the Logo, like you wanted, from the site settings, but that creates an image tag as opposed to a background image. So the problem becomes how to change it from being an image into being a background. One thing you could try, then, is javascript. Use the javascript to get the "src" attribute from the logo image and then apply the image location to the "background-image" property of the header element. That is the least customization I can think of that still lets you set the background from the site settings.

  • Matt
share|improve this answer

You can probably use an alternate stylesheet with a class that calls the image from the picture library relative to its css file location. Best option would be to create a branding structure like this :-

/Style Library > YourProjectName > YourCssfile.css 
/Picture Library > OwnerUploadedImage.jpg

In your masterpage use the class on the td or div where you want to the background image to appear. On your css create the class with a style like background-image:url('../Picture Library/banner.jpg')

Ofcourse this will work once you have included the correct references to this stylesheet in the masterpage. From here on whenever an image with the same name and file extension is uploaded in the picture library by the owner it will appear in the masterpage. Only drawback is the solution is filename specific and you gotta hardcode your imagename in the css class.

share|improve this answer

Try this from this forum.

background-image:url('../Style Library/Images/B360 Large.png')


background-image:url('../Style Library/Images/B360 Large.png')
share|improve this answer

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.