Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to hide the title from a link with CSS?

I have an anchor element with a title attribute. I want to hide the popup that appears when hovering over it in the browser window. In my case, it is not possible to do something like this,

$("a").attr("title", "");

Because of jQuery Mobile the title will reappear after certain events occur (basically everytime the anchor element gets redrawn). So I hope to hide the title via CSS.

Something like:

a[title] {
    display : none;
}

doesn't work, since it hides the entire anchor element. I want to hide the title only. Is this even possible? The popup shouldn't display.

like image 986
jtepe Avatar asked Mar 12 '13 14:03

jtepe


People also ask

How do I hide the title tooltip?

To remove the title tooltips globally, add the following code in the Theme Options > JS: jQuery(document). ready(function($){ $('a'). removeAttr("title"); });

How do you hide content in CSS?

You can hide an element in CSS using the CSS properties display: none or visibility: hidden . display: none removes the entire element from the page and mat affect the layout of the page. visibility: hidden hides the element while keeping the space the same.


2 Answers

Using the following CSS property will ensure that the title attribute text does not appear upon hover:

pointer-events: none;

Keep in mind that JS is a better solution since this CSS property will ensure that the element is never the target of any mouse events.

like image 149
Blake Frederick Avatar answered Oct 13 '22 23:10

Blake Frederick


You can wrap your inner text in a span and give that an empty title attribute.

<a href="" title="Something">
  <span title="">Your text</span>
</a>
like image 42
Arjan Frans Avatar answered Oct 14 '22 01:10

Arjan Frans