Skip to content Skip to sidebar Skip to footer

How To Hide An Anchor Tag By Href #id Using Css

I have different anchor tags with href=#ids and I need to hide them using a general css rule for all of them, Content xxxxxxxxx Table 1.Content xxx

Solution 1:

Try using attribute selectors:

a[href='#tab1']{ display: none }

Or even simply

[href='#tab1']{ display: none }

http://www.w3.org/TR/CSS2/selector.html


Solution 2:

Why not just create a CSS class for your anchors and hide them using that class?

<a href="#tab1" class="hiddenTab">foo</a>

And in your CSS:

a.hiddenTab {visibility:hidden; display:none;}

All the anchors you'd want to hide would just use "class='hiddenTab'"


Solution 3:

#wrap a[href="#tab1"]{
display:none;
}

Solution 4:

Try using a[href*="#"] {display: none;} This selectors identifies a # in the href attribute of an anchor and if found it applies the style

You can use it in another way such as header a[href*="#"] {display: none;} So you don't mess all the anchors on the site!


Solution 5:

If you want to hide all a tags which have href set, you can do this:

a[href] { display: none; }

Post a Comment for "How To Hide An Anchor Tag By Href #id Using Css"