SharePoint 2013 - Hide Root Node Link in Global Navigation using CSS

The other solutions I've found regarding this involve javascript/jquery.  Was unable to find any CSS that resolves the issue nicely.

This seems to have resolved the issue for me so far without compromising any other areas of the site.  It hides the initial link and then goes back to displaying the rest of the navigation as per normal:

<style type="text/css">
.ms-core-listMenu-horizontalBox li.static > a{
display: none !important;
}
.ms-core-listMenu-horizontalBox li.static > ul a{
display: block !important;
}
</style>

Comments

  1. Could you please tell me where to put this css code. I use "seattle" theme...

    ReplyDelete
    Replies
    1. Thank you for your answer.
      I created the CSS file with the following code:

      style type="text/css"

      .ms-core-listMenu-horizontalBox li.static > a
      {
      display: none !important;
      }
      .ms-core-listMenu-horizontalBox li.static > ul a
      {
      display: block !important;
      }
      /style

      Could you tell me where should I put the reference to this file?

      I am using seattle theme.

      Should I put the reference in head or the body part?

      Delete
    2. Hi Srdjan,
      Best practise is to put the reference to the .css file in the Head of the master file, so that the page doesn't render without the styles already having been applied.

      You can reference like this:

      < SharePoint:CssRegistration Name="<% $SPUrl:~sitecollection/Style Library/SG2013/css/bootstrap3.min.css %>" runat="server" />

      Cheers,
      Brett

      Delete
    3. Brett,

      I did everything you stated, it does not remove the home link...

      Srdjan

      Delete
    4. Hi Srdjan,
      I just created a blank Web Application. then created a copy of the Seattle.Master file as you can't modify the original. I then pasted the CSS code directly onto the master page and checked in a major version and it worked perfectly.

      Oh, I also had to change the master page that the site was pointing to in Site Settings > Master Page > Seattlecopy.master.

      I presume it's just the connection to the CSS file that is the problem.

      Remember also that when you are creating a file for your CSS you don't need to use the open and close < style > blocks.

      Maybe try copying the CSS directly to the master file and seeing if that works for you first.

      Cheers,
      Brett

      Delete
    5. Hi Srdjan-
      I added a link on the _layouts/changesitemasterpage.aspx to a css file with this in it under the section where it asks for an alternate CSS URL. It does not remove my root node. Is there something I am missing?

      Thanks,
      Jesse

      Delete
    6. Hi Jesse,
      I've never used the Alternate CSS URL option on that page, I usually insert the link into the Master page directly via SharePoint Designer. This way you can force SharePoint to look at your CSS file AFTER it looks at the CORE.css file.

      However, what you did should still work. Is the code above the only code you have inside your CSS file?

      Also, just to make sure: inside the CSS file, you don't need to reference the following lines:
      style type="text/css"
      /style

      Cheers,
      Brett

      Delete
  2. How can you change this in the Master page rather than through CSS?

    ReplyDelete

Post a Comment

Popular posts from this blog

SharePoint - Field type [FieldName] is not installed properly. Go to the list settings page to delete this field.

Office 365 Groups - Quickly find the GUID of a O365 Group

Export Group Membership From Active Directory Using Power Query