Showing posts with label SharePoint Branding. Show all posts
Showing posts with label SharePoint Branding. Show all posts

Monday, July 15, 2013

Fixed width SharePoint 2010 master page



In this article we will add CSS that can align the SharePoint 2010 master page to center of the web page.

In the Master page search for s4-workspace and add the s4-nosetwidth class to that div shown below

<div id="s4-workspace" class="s4-nosetwidth">
</div>

Then add the below CSS in the style sheet file

body{
overflow:auto!important;
}
form
{
width:1024px!important;
margin-left:auto!important;
margin-right:auto!important;
}
body #s4-workspace {
    left: 0!important;
     overflow: visible !important;
    position: relative!important;
}

Sunday, July 29, 2012

Dynamically Apply/change SharePoint 2010 Header Image

In this post I will explained how we can dynamically apply/change SharePoint 2010 site Header Image. Create Image library, add image named “SiteHeaderImg.png” and below code in master page
<script type="text/javascript">
  
    function ChangeImage() {
        try {
     var URL_str = L_Menu_BaseUrl + '/ImageLibrary/SiteHeaderImg.png';
            
                document.getElementById("s4-titlerow").style.background = "background-image: url('" + URL_str + "') no-repeat";
                /* (Works in Firefox) */
  document.getElementById("s4-titlerow").style.background = "url('../ImageLibrary/SiteHeaderImg.png') no-repeat";
      
        }
        catch (e) {
            alert(e);
        }
    }
    _spBodyOnLoadFunctionNames.push("ChangeImage()");
 
</script>