1

Suppose I have a link <a href="#" title="Hello, World!">. I want to style parts of the title tooltip attribute. For example, I want to have the Hello part be bold. I'm not trying to style both Hello and World, just the Hello part.

I have tried putting HTML tags inside of the attribute, but they appear to have no effect (if I enter <a href="#" title="<b>Hello,</b> World!">, the title text prints out <b>Hello,</b> World!, which is not what I want. I have made a JSFiddle demo of what happens.

Is it possible to do this using pure CSS?

Also, I have seen this, but it's not what I wanted. It's close, however.

Community
  • 1
  • 1
Piccolo
  • 1,612
  • 4
  • 22
  • 38

2 Answers2

2

You can't put HTML in the attribute title, it's not a valid code but I beleive you can use hint.css library: http://kushagragour.in/lab/hint/. Completely css-based and easy-to-use:

<a href="http://somewhere/" class="hint  hint--bottom" data-hint="Hello" title="Hello world">Your link</a>
Afshin Mehrabani
  • 33,262
  • 29
  • 136
  • 201
1

I think the only way for you to achieve what you want is to make a div with the style you want, hide it, and on hover - show it.

ParPar
  • 7,355
  • 7
  • 43
  • 56