I have created this piece of HTML
code it has a css style tool tip and a link to that tool tip, whenever you hover over on it will show a piece of text.
But now I want to display two or more lines of text in my tool tip . How can I achieve that?
I tried using \n
and <br>
but has no effect.
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
}
</style>
<title>CSS3 tooltip</title>
<style type="text/css">
.ordertooltip {
display: inline;
position: relative;
}
.ordertooltip:hover:after {
background: #333;
background: rgba(0, 0, 0, .8);
border-radius: 5px;
bottom: 26px;
color: #fff;
content: attr(title);
left: 20%;
padding: 5px 15px;
position: absolute;
z-index: 98;
width: 220px;
}
.ordertooltip:hover:before {
border: solid;
border-color: #333 transparent;
border-width: 6px 6px 0 6px;
bottom: 20px;
content:"";
left: 50%;
position: absolute;
z-index: 99;
}
</style>
</head>
<body>
</br>
</br>
</br>
</br> <a title="1-Line One\n2-Line two<br>3-Line Three" class="ordertooltip"><span title="More">My Tip</span></a>
</body>
</html>
UPDATE
Ok using
works in a way that i don't apply my css but when i apply it it's not working again.
UPDATE 2
thanks for your replies but i should say i can't use any external libraries.
and i need to support at least Firefox, therefore hitting enter wont work for me.
UPDATE 3
I found a workaround for my own problem and answer it here but it certainly is not and acceptable answer because it's just a workaround. hope someone bring a nice solution for the original question.