Hiding the ribbon – SharePoint 2013

Add the following code to hide the ribbon in Share Point 2013.

<SharePoint:SPSecurityTrimmedControl PermissionsString="FullMask" runat="server">
<div id="ms-designer-ribbon">
<!--SID:02 {Ribbon}-->
<!--PS: Start of READ-ONLY PREVIEW (do not modify) --><div class="DefaultContentBlock" style="background:rgb(0, 114, 198); color:white; width:100%; padding:8px; height:64px; overflow:hidden;">
In true previews of your site, the SharePoint ribbon will be
here.</div><!--PE: End of READ-ONLY PREVIEW -->
</div>
</SharePoint:SPSecurityTrimmedControl> 

Once you apply the above code snippet the vertical bar would be get hidden.  For you to get the ribbon back, you have to over ride the style attribute of the body, so for that add the attribute to the style=”overflow: scroll !important” to the BODY element of your master page. Once you apply the same you will get the vertical scroll bar back. The reason behind this is that the master pages have a link to corev15.css. This stylesheet sets overflow to hidden for the BODY element, which removes the scroll bar.

more about the SPSecurityTrimmedControl you can find it in the below link : http://msdn.microsoft.com/en-us/library/jj822366.aspx

Advertisements

One Comment to “Hiding the ribbon – SharePoint 2013”

  1. Thank you very much. a very good post. I was facing the scroll hide issue and it solved by appling overflow:scroll on body. I have read various blog but very one missed that part.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: