Is it possible to apply CSS according to the type of user and/or his permissions? (e.g., admin, regular users, etc...)

For example, I'd like to hide the #s4-ribbonrow for regular users since they will not be allowed to modify pages but I'd like to leave this displayed for admins since they need to be able to save a page after editing.

I'm using SP2013 Online

1 Answer 1


You can update the master page and then use security trimming as below

  1. Open your SharePoint master page
  2. Locate this line:

    <div id="s4-ribbonrow" class="s4-pr s4-ribbonrowhidetitle">
  3. Change it to:

    <div id="s4-ribbonrow" class="s4-pr s4-ribbonrowhidetitle" style="display:none">
  4. Now find the end of the “s4-ribbonrow” tag and add following block right after it:

    <Sharepoint:SPSecurityTrimmedControl ID="SPSecurityTrimmedControl2" runat="server" PermissionsString="AddAndCustomizePages">
        <script type="text/javascript">
        document.getElementById("s4-ribbonrow").style.display = "block";
  5. Save the new master page and publish it.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.