How to hide Ribbon in SharePoint 2010 using CSS

In this hint, I will explain How to hide ribbon in SharePoint 2010 via CSS by following the mentioned steps below :

Steps :

In case of you need to hide the ribbon for only Anonymous users / Visitors users or the users that not have site permission do the following :

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

Look and feel MasterPage

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

Master paged assigned

  • Open SharePoint Designer –> Open your site –> From left side Click on Master Pages –> Right Click on your custom Master Page –> Check Out.

Check Out Master Page

  • Right Click on Master Page –> Edit File Advanced Mode.

edit file in andvanced mode

  • Below the <Header> tag add the following code.
<style type="text/css">
#s4-ribbonrow { display: none !important; }
</style>
<SharePoint:SPSecurityTrimmedControl PermissionsString="ManagePermissions" 
runat="server">
<style type="text/css">
#s4-ribbonrow { display: block !important; }
</style>
</SharePoint:SPSecurityTrimmedControl>

add css to header to hide ribbon

  • In PermissionsString attribute,you can add any permission type from the following based on your requirement :
    • FullMask.
    • 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 your changes.

Save Changes to Master Page

  • Publish Master Page.

Publish Master Page

  • Approve Master Page.

Approve Master Page

  • Master Page Gallery will be shown –> Below Approval status Pending –> Approve your Master Page By clicking on Arrow and select Approve and Reject.

Approve Master Page 1

  • Now open your site with user who have Read permission or Anonyms. The ribbon should be like this :

Ribbon Hidden

  • Open your site with user who can manage permission. the ribbon should be shown like this.

Ribbon Shown

In case of you need to hide ribbon from all users, follow the previous steps to open your custom master page, and simply in your custom Master Page below Header tag add the following style :

<style type="text/css">
#s4-ribbonrow { display: none !important; }
</style>

Enjoy 🙂

  • See also How to hide the ribbon in SharePoint 2013 check this hint.
Advertisements

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