I'm using some code that shows a text box with when you hover your mouse over some text. The problem is the text that is displayed in the text box comes from an attribute of the <a>
tag it's in and I can't format it. I want to make a list in the text box, but I can only make it just a wall of text.
HTML:
<a data-text="Could use this text instead of title" title="1. ~~~~ List item (/br)~~~~
2. ~~~~ List item ~~~~
3. ~~~~ List item ~~~~
4. ~~~~ List item ~~~~
5. ~~~~ List item ~~~~ " class="tooltip">Hover over this text</a>
CSS:
.tooltip{
display: inline;
position: relative;
}
.tooltip:hover:after{
background: #333;
background: rgba(0,0,0,.8);
border-radius: 5px;
bottom: 26px;
color: #fff;
content: attr(title);
left: 100%;
padding: 5px 15px;
position: absolute;
z-index: 98;
width: 220px;
}
content: attr(title);
.tooltip:hover:before{
border: solid;
border-color: #333 transparent;
border-width: 6px 6px 0 6px;
bottom: 20px;
content: "";
left: 50%;
position: absolute;
z-index: 99;
}
Check out this demo: http://jsfiddle.net/h3tqwust/1/
How can I format the text (have line breaks) for this?