Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 <a href="#tab1">Table 1</a>.Content xxxxxxxxxxxx <a href="#tab2">Table 2</a>

I was trying to use something like this:

#wrap a='#tab1'{
display:none;
}

Any idea how to do it?

like image 696
Jces Avatar asked Feb 06 '12 18:02

Jces


People also ask

How do I hide a tag link?

Use CSS styling to make your links invisible The first way is by using none as the pointer-events CSS property value. The other is by simply coloring the text to match the background of the page.

How do I stop a href tag?

To prevent an anchor from visiting the specified href, you can call the Event interface's preventDefault() method on the anchor's click handle.

How do I make an anchor link not clickable?

In order to disable a HTML Anchor Link (HyperLink), the value of its HREF attribute is copied to the REL attribute and the value of HREF attribute is set to an empty JavaScript function. This makes the HTML Anchor Link (HyperLink) disabled i.e. non-clickable.


2 Answers

#wrap a[href="#tab1"]{
display:none;
}
like image 61
frazras Avatar answered Sep 29 '22 01:09

frazras


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'"

like image 33
Tim Avatar answered Sep 28 '22 23:09

Tim