Hi Eric,
Yes with a width its easy to do but not so easy fluid.
You can do it for Firefox only without changing the markup like this:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
<style>
.tooltip {
display:inline;
position:relative
}
.tooltip:hover { text-decoration:none }
.tooltip:hover:after {
background:#111;
background:rgba(0,0,0,.8);
border-radius:5px;
bottom:18px;
color:#fff;
content:attr(title);
display:table;
left:-1000px;
right:-1000px;
margin:auto;
padding:5px 15px;
position:absolute;
white-space:nowrap;
z-index:98;
text-align:center;
}
.tooltip:hover:before {
border:solid;
border-color:#111 transparent;
border-width:6px 6px 0 6px;
bottom:12px;
content:"";
display:block;
left:50%;
margin-left:-3px;
position:absolute;
z-index:99
}
</style>
</head>
<body>
</body>
<h1>Firefox only</h1>
<p>This is some text to testing<a href="#" title="Sample tooltip with much longer text" class="tooltip">Link</a>and some more text and some more text and some more text and some<a href="#" title="Sample tooltip" class="tooltip">Link</a>more text and some more text and some more text text and some more text and some<a href="#" title="Sample" class="tooltip">Link</a>more text and some more text and some more text</p>
</body>
</html>
Other browsers won't play ball and you would need to add an extra element and move the tooltip which kind of defeats the purpose a bit.
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
<style>
.tooltip {
display:inline-block;
position:relative
}
.tooltip:hover { text-decoration:none }
.tooltip b {
bottom:18px;
margin:auto;
position:absolute;
display:block;
z-index:98;
text-align:center;
left:-1000px;
right:-1000px;
}
.tooltip:hover b:after {
background:#111;
background:rgba(0,0,0,.8);
border-radius:5px;
color:#fff;
content:attr(title);
display:table;
margin:auto;
padding:5px 15px;
white-space:nowrap;
z-index:98;
text-align:center;
}
.tooltip:hover b:before {
border:solid;
border-color:#111 transparent;
border-width:6px 6px 0 6px;
bottom:-6px;
content:"";
display:block;
left:50%;
margin-left:-3px;
position:absolute;
z-index:99
}
</style>
</head>
<body>
</body>
<p><a href="#">test</a></p>
<p>This is some text to testing<a href="#" class="tooltip">Link<b title="Sample tooltip with much longer text"></b></a>and some more text and some more text and some more text and some<a href="#" class="tooltip">Link<b title="Sample tooltip"></b></a>more text and some more text and some more text text and some more text and some<a href="#" class="tooltip">Link<b title="Sample"></b></a>more text and some more text and some more text</p>
</body>
</html>
Bookmarks