Boky
Boky

Reputation: 12064

I get two link titles

I have a problem with the link titles. I tried to style the link title with css. My css is :

a[title]:hover:after {
  content: attr(title);
  padding: 2px 8px;
  position: absolute;
  left: 0;
  top: 100%;
  white-space: nowrap;
  -moz-border-radius: 5px;
  -webkit-border-radius: 5px;
  border-radius: 5px;
  border:1px solid #bce8f1;
  background-color:#d9edf7;
  color:#31708f;
  font-weight:700;
  box-shadow: 0 0 6px #bce8f1;
  z-index:99999999;
}

But when I hover over the link, I get this styled title but I get also the old one like on the photo.

enter image description here

Any ideas?

Thanks

Upvotes: 0

Views: 75

Answers (2)

Rounin
Rounin

Reputation: 29463

Use data-title instead of title:

HTML:

<a href="mailto:[email protected]" data-title="Als u nog vragen heeft, stel ze gerust. Wij staan tot uw dienst!">

CSS:

a[data-title]:hover::after {
  content: attr(data-title);
  ...
}

Upvotes: 4

Donnie D&#39;Amato
Donnie D&#39;Amato

Reputation: 3940

Instead of using the title attribute which has a default action/style, I'd create my own.

<a href="/someplace.html" data-title="The Title of Someplace">Someplace</a>

Then you would change the CSS to reflect the new attribute.

a[data-title]:hover:after {
  content: attr(data-title);
  ...
}

Upvotes: 4

Related Questions