How to make multi-line title in div tag?

I would like the following div tag to display a mouse tip. But it displays it as one line. How can I make it display multiple lines?

<div title="Have a nice<br />day">blah</div>
+3
source share
3 answers

modern browsers seem to show a hint on a new line after the carriage return character:

<!-- i've pressed Enter after word "line" -->
<div id="myDiv" title="first line
multiline">Hello world!</div>

Or you can try setting the value by javascript:

var myDiv=document.getElementById('myDiv'); 
myDiv.title = "first line \n multiline";
+3
source

Without replacing the whole thing with elements created by JS (or ugly CSS hacks) and positioned using CSS, you cannot, at least not reliably.

, , , . , . - , , .

, , , .

0

You might want to learn some javascript hints.

0
source

Source: https://habr.com/ru/post/1758050/


All Articles