7/02/2012

Hide Top Bar, Ribbon, Quick Launch in SharePoint 2010

The Application Pages in SharePoint 2010 by default contains the Ribbon Bar, Top Bar and Quick Launch. I had requirement where I wanted to remove these elements.  One way of doing so is by creating new page layout which is very time consuming task. Instead, I figured out another easy way to hide these controls. One needs to pass a Parameter with the URL. [ ?IsDlg=1 ] and SharePoint will hide these elements when It gets IsDlg Parameter on URL. But another problem is I can/should not pass these parameters every time I request the URL. So what's the solution?? :) Simple Just add the below css Code in Application Page under PlaceHolderMain section.

<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>

This will hide the elements and only the content will be shown. Though if you use this code in SharePoint Site Pages with Content Editor Webpart, you won't be able to check in the page since the toolbar goes hidden :P You can still use it, when you want to make changes, open the page in browser with parameters [ ?Contents=1 ] which opens the page in WebPart maintenance mode. Remove the content editor webpart and re-open the page. Make the changes and add content editor webpart at last along the CSS Code. To check in the page use Site Pages Library. Have fun!! Enjoy!!

0 comments: