August 29, 2012

Hide Left Navigation, Top Navigation, Ribbon, etc in SharePoint 2010

I was trying to find a way to hide the quick launch for a particular page in SharePoint 2010 and this blog explains how to use a Content Editor Web Part to hide the quick launch which works well... with a minor modification... otherwise it's pretty much the same.  See that blog for details.

See far below for hiding the everything including the top navigation, ribbon etc.

Here's the quick process:
  1. Add a Content Editor web part (under Media and Content).
  2. Click to edit the new web part and under the 'Format Text' ribbon, in the Markup section click HTML --> Edit HTML Source.
  3. Paste the following text (slightly modified from Christian's blog):

  4. <style type="text/css">#s4-leftpanel { DISPLAY: none}.s4-ca { MARGIN-LEFT: 0px}</style>
  5. Click OK.
  6. I had to open the webpart in SharePoint designer and set the webpart to hidden... the option was greyed out in the browser.
I also changed the title on the Web Part to "Hide Quick Launch" so I could quickly identify exactly what it does.


The same concept can be applied to the 'Recently Modified' added to the left navigation for Wiki pages as shown here on Microsoft.com.  The content is slightly different:

<style type="text/css"> .s4-recentchanges { display:none; } < /style>


Here's how to hide everything using a Content Editor web part (CEWP) as I found it on the Sharep10nt blog.  The way I accomplished it is I put this content into a txt file and saved it to the Site Assets library then pointed the CEWP to that file.  I can then simply remove that file if I need to edit the page.  Another option for disabling the CEWP is appending "?Contents=1" to the URL then selecting and closing the CEWP.  Here's the CEWP content:

<style type="text/css">
#s4-ribbonrow, .ms-cui-topBar2, .s4-notdlg, .s4-pr s4-ribbonrowhidetitle, .s4-notdlg noindex, #ms-cui-ribbonTopBars, #s4-titlerow, #s4-pr s4-notdlg s4-titlerowhidetitle, #s4-leftpanel-content {display:none !important;}
.s4-ca{margin-left:0px !important; margin-right:0px !important;}
</style>