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>
Liked this post? Check out my other posts regarding Global Navigation here:
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>
Liked this post? Check out my other posts regarding Global Navigation here:
Could you please tell me where to put this css code. I use "seattle" theme...
ReplyDeleteThank you for your answer.
DeleteI 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?
Hi Srdjan,
DeleteBest 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
Brett,
DeleteI did everything you stated, it does not remove the home link...
Srdjan
Hi Srdjan,
DeleteI 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
Hi Srdjan-
DeleteI 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
Hi Jesse,
DeleteI'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
How can you change this in the Master page rather than through CSS?
ReplyDelete