36

Possible Duplicate:
How can I use a carriage return in a HTML tooltip?

I would like to display the "title" attribute tooltip in several lines, so it looks like this:

Line 1
Line 2

I tried to do:

<div title="Line 1\nLine 2">Secret</div>

but it didn't work.

Is that possible?

Peter Mortensen
  • 30,030
  • 21
  • 100
  • 124
Misha Moroshko
  • 157,453
  • 220
  • 487
  • 722

3 Answers3

97

You can enter &#10;. In other words:

<div title="Line 1&#10;Line 2">Secret</div>
anothershrubery
  • 19,639
  • 11
  • 51
  • 94
7

As stated in How can I use a carriage return in a HTML tooltip? you can just do it like this:

<div title="Line 1  
Line 2">Secret</div>

Though it is said that it doesn't work with Firefox.

Community
  • 1
  • 1
nollfem
  • 140
  • 1
  • 6
2

Either add new lines within the HTML content itself

<div title="Line 1
Line 2">Secret</div>

Or make your own tooltip using JavaScript and CSS.

Peter Mortensen
  • 30,030
  • 21
  • 100
  • 124
AlanFoster
  • 7,818
  • 5
  • 34
  • 52