How to hide SharePoint 2013 Ribbon via CSS ?

In this hint, I will explain How to hide the SharePoint 2013 ribbon via CSS based on :

  • Permission String (For only Anonymous Users / Visitors users or the users that not have site permission).
  • For all users.

Steps:

Hide SharePoint Ribbon for only Anonymous Users / Visitors users or the users that not have site permission.

  • First, Check the Master Page name that has been assigned to your site.
  • Go to Site Action > Site Settings > Look and Feel > Master Page.

Master Page - look and feel

  • Below Site Master Page > Check the assigned Master Page name.

Mater Page Assigned

  • Open SharePoint Designer.

Open SharePoint Designer

  • Open your site > From left side Click on Master Pages.

Site Objects Master Pages

  • In SharePoint 2013 There are two related files for Master Page (HTML, Master)
  • Right Click on your custom Master Page with HTML extension > Check Out.

Check Out Master Page

  • Again, Right Click on Master Page with HTML extension > Edit File Advanced Mode.

Edit file in advanced mode

  • Search for DIV with ID “ms-designer-ribbon
< div id="ms-designer-ribbon" >
  • Surround it with this tag SharePoint:SPSecurityTrimmedControlto looks the following
<!--MS:<SharePoint:SPSecurityTrimmedControl runat="server"  
PermissionsString="FullMask">-->
< div id="ms-designer-ribbon" >
 <!--SID:02 {شريط}-->
 <!--PS: تشغيل معاينة للقراءة فقط (عدم التعديل) -->
color:white; width:100%; padding:8px; height:64px; overflow:hidden;"> سيكون شريط SharePoint هنا عندما تتم معاينة الملف الخاص بك أو عندما يكون مطبقاً في موقعك الخاص.
<!--PE: إنهاء معاينة للقراءة فقط -->
</div>
<!--ME:</SharePoint:SPSecurityTrimmedControl>-->

ms-designer-ribbon

  • In PermissionsString attribute, you can add any permission type based on your requirement from the following:
    • FullMask.
    • EmptyMask.
    • ManagePermissions.
    • ManageSubwebs.
    • ManageWeb.
    • AddAndCustomizePages.
    • BrowseDirectories.
    • ViewPages.
    • EnumeratePermissions.
    • ManageAlerts.
  • From left side > Click on Master Pages > Right Click on your custom Master Page > Check In.

Check in master page

  • Save the changes.

Save changes in master page

  • Publish Master Page.

Publish Master Page

  • Now, open your site with a user who have Read permission or Anonymous. The ribbon should be hidden.

Ribbon hidden

  • Open your site with a user who can manage permission. The ribbon should be shown.

Ribbon Shown

Hide SharePoint 2013 Ribbon for all users,

  • Follow the previous steps to open your custom master page,
  • Simply, search for DIV with ID "ms-designer-ribbon" and add this style (style="display: none !important;") to be like this :
< div id="ms-designer-ribbon" style="display: none !important;" >

Enjoy 🙂

See also, How to hide the ribbon in SharePoint 2010

Advertisements

2 thoughts on “How to hide SharePoint 2013 Ribbon via CSS ?

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