Forum Discussion

Nigel_Price9911's avatar
Nigel_Price9911
Iron Contributor
Nov 15, 2017
Solved

IS it Possible to remove the left hand nav from a modern team site

Hi

 

Is it possible to remove the left hand navigation bar from a modern team site so that If I use a Hero Web Part it can take up the whole of the screen ?

 

Then can I put the old search box in the top right hand corner of the screen and point it to a classical Search Results page where I have refiners etc ?

 

Thanks

 

Nigel

  • I think the supported way to do this would be to write an extension (so it is applied to all pages in the site) that implements CSS to make the changes you are after.

     

    The CSS to hide the left hand nav on a modern page is:

     
    nav[role='navigation'] {
        display: none !important;
    }
    div[class^='searchBox_'] {
        display: none !important;
    }
    div[class^='pageContainer_'] {
        left: 0 !important;
    } 

     

    The same extension that injects this CSS could also display a search box (if you want it on every page), that redirects users to your search results page and injects the query into the 'k' querystring parameter

     

    hope it helps,

     

    Nigel

     
  • G_Vijai_Kumar's avatar
    G_Vijai_Kumar
    Copper Contributor

    Nigel_Price9911 

     

    The best way is to delete all left side navigation links then reload the page, quick launch disappears. It works.

     

    Best Regards,

    G Vijai Kumar

    • nlvraghavendra's avatar
      nlvraghavendra
      Copper Contributor
      This is the only solution that worked for me in a SharePoint modern team site.
  • dancourcelles's avatar
    dancourcelles
    Copper Contributor

    Nigel_Price9911 I found that you can hide the div in a CSS stylesheet. Just replace the red text below with the id for your div and it should hide it. I've noticed that the div changes after a while which means I need to go update the id for that div but it works well otherwise.

     

    div.spNav_1846ed68 {position: absolute; visibility: hidden; display: none !important;}
     
     
    • PCH_Mark's avatar
      PCH_Mark
      Copper Contributor

      dancourcelles I was building personal pages for employees that don't require LHS navigation and was able to remove it from "Site Settings" -->"Navigation" --> "Structural Navigation: Editing and Sorting".  Select "Current Navigation" and delete all items in the list.  Click OK.  As a note, this removed the navigation, but you can't use the column space that was vacated by the navigation.  So even with a 4 column layout (3 columns plus the vertical column), the columns just float left and the (now empty and unusable) fifth column floats to the right hand side of the page.

      • Larisaf's avatar
        Larisaf
        Copper Contributor

        PCH_Mark 

        When I remove left hand navigation my search box disappears. When I refresh screen it flickers for less then a second and boom--gone.

        How do I get it back, I need search box.

  • Angus Muir's avatar
    Angus Muir
    Copper Contributor

    In modern pages you can do this without css - just in site settings, Navigation Elements -> uncheck Quick launch

  • Aseem Anand's avatar
    Aseem Anand
    Copper Contributor

    Yes, It can be done. Go to Site Settings -> Navigation Elements (under Look and Feel).

    Uncheck "Enable Quick launch". This should remove the left navigation pane.

    • Jason Brownhill's avatar
      Jason Brownhill
      Brass Contributor

      Sometimes the simplest solutions are always the last to be suggested, thanks for that!

  • Chad Renstrom's avatar
    Chad Renstrom
    Copper Contributor

    I found the answer without using any stylesheets.  Under Site Settings -> change the look, then select the current look, ten on the next page change the Site Layout to Oslo.

     

    • Dean_Gross's avatar
      Dean_Gross
      Silver Contributor

      Chad Renstromwhat kind of site are you doing that on? when i try it on a modern group enabled team site, it does not work on the home page.

  • I think the supported way to do this would be to write an extension (so it is applied to all pages in the site) that implements CSS to make the changes you are after.

     

    The CSS to hide the left hand nav on a modern page is:

     
    nav[role='navigation'] {
        display: none !important;
    }
    div[class^='searchBox_'] {
        display: none !important;
    }
    div[class^='pageContainer_'] {
        left: 0 !important;
    } 

     

    The same extension that injects this CSS could also display a search box (if you want it on every page), that redirects users to your search results page and injects the query into the 'k' querystring parameter

     

    hope it helps,

     

    Nigel

     
    • Oleg Rumiancev's avatar
      Oleg Rumiancev
      Copper Contributor

      Thanks Nigel, that's what I am trying to do from the extension.

      Did you notice a that left nav is still rendered for a split second before our application customizer actually loads?

      • Nigel Witherdin's avatar
        Nigel Witherdin
        Iron Contributor

        Hey,

         

        mine is actually running from a web part on the page (not a customizer) and yes it definitely shows the LHS nav for a flicker before the CSS is processed.

         

        There may be a better way to get the CSS processed earlier in the page load, but I am not sure how/what is the best way to achieve that - sorry.

         

        If you do find out, please post the solution on this thread as it would be good to know

         

        Thanks

         

        Nigel

Resources