Skip to content

Instantly share code, notes, and snippets.

@muratpurc
Created September 22, 2011 10:42
Show Gist options
  • Save muratpurc/1234515 to your computer and use it in GitHub Desktop.
Save muratpurc/1234515 to your computer and use it in GitHub Desktop.
HTML/CSS: Cross-Browser tooltip with CSS
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Example Cross-Browser tooltip with CSS</title>
<style type="text/css"><!--
body {
padding-top:130px;
}
#box {
color:black;
background-color:transparent;
position:absolute;
top:100px;
left:30px;
z-index:1;
}
#box a {
color:#f6e4c1;
background-color:#b8ab8f;
font-family:arial, sans-serif;
font-size:100%;
font-weight:bold;
text-decoration:none;
display:block;
padding:5px;
border-top:2px solid #e4d9c0;
border-right:2px solid #837c6b;
border-bottom:2px solid #837c6b;
border-left:2px solid #e4d9c0;
}
#box a:visited {
color:#f6e4c1;
background-color:#b8ab8f;
}
#box a:hover {
color:#f6e4c1;
background-color:#b8ab8f;
text-decoration:none;
width:400px;
border-top:2px solid #837c6b;
border-right:2px solid #e4d9c0;
border-bottom:2px solid #e4d9c0;
border-left:2px solid #837c6b;
}
#box a:active {
color:#f6e4c1;
background-color:#b8ab8f;
}
#box a .info {
display:none;
}
#box a:hover .info {
color:black;
background:#b8ab8f;
font:14px courier,sans-serif;
display:block;
padding:5px;
text-align:justify;
}
--></style>
</head>
<body>
<div id="box">
<a href="#">Infobox <span class="info">Inhalt der Infobox: Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed
diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis
nostrud exercitation ulliam corper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem veleum iriure
dolor in hendrerit in vulputate velit esse molestie consequat, vel willum lunombro dolore eu feugiat nulla facilisis at
vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait
nulla facilisi</span></a>
</div>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna
aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exercitation ulliam corper suscipit lobortis nisl ut aliquip
ex ea commodo consequat.Duis autem veleum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel willum
lunombro dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril
delenit augue duis dolore te feugait nulla facilisi</p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment