Remove Left-Hand Nav on a List Form

Today I was asked to remove the left-hand navigation on the New Item form for a list in Office365. The form was opening in full-page mode, rather than the “modal dialog” format (aka “LightBox”) and was showing the site navigation on the left. The site owner did not want this.

This should also work on any other type of SharePoint page where you want to hide the left nav.

So I found this video which provided this excellent CSS code:

<style type="text/css">
/*      removes navigation content      */
#sideNavBox
{
display: none !important; 
width: 0px !important; 
margin: 0px !important;
}
/*      removes white space      */
#contentBox
{
margin-left: 0px !important;
}
</style>

Two important things to point out:
1. You’ll need to add a Content Editor Web Part (CEWP) to the form page. Edit the web part, then select Edit Source from the ribbon, and paste in the code there.

Edit Source button from the Ribbon
Make sure to use the Edit Source feature

2. If you cannot edit the form page, append ?ToolPaneView=2 to the URL, which I wrote about previously.

 

You cannot copy content of this page