Skip to content

Instantly share code, notes, and snippets.

@jordandobson
Created August 12, 2009 20:43
Show Gist options
  • Save jordandobson/166750 to your computer and use it in GitHub Desktop.
Save jordandobson/166750 to your computer and use it in GitHub Desktop.
An example of using a CSS+Unicode help bubble with an input field.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Help Bubble with CSS + Unicode + Input field</title>
<!--
Created by: Jordan Robert Dobson
[email protected]
http://MadeBySquad.com
http://twitter.com/JordanDobson
-->
<style type="text/css">
body{
text-align: center;
margin: 5.0em 0;
font-family: "helvetica neue", sans-serif;
}
.field,
.bubble{
margin: 0 auto;
}
.bubble,
.bubble em,
.field{
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
}
.bubble,
.bubble em{
background-color: #eee;
position: relative;
}
.bubble{
width: 200px;
display: block;
margin-left: 105%;
box-shadow: #999 1px 1px 1px;
-moz-box-shadow: #999 1px 1px 1px;
-webkit-box-shadow: #999 1px 1px 1px;
}
.bubble:before{
text-shadow: #999 1px 1px 1px;
color: #eee;
position: absolute;
text-align: center;
font-size: 1.5em;
width: 1.0em;
height: 1.0em;
line-height: 1.0em;
/* Left Arrow */
content: "\25C0";
/* Position Arrow */
left: -.5em;
margin-top: -.50em;
top: 33%;
}
.bubble em{
display: block;
padding: 1.25em;
text-align: center;
z-index: 2;
color: #666;
font-size: .75em;
font-style: normal;
}
.field{
border: 1px solid #ccc;
width: 400px;
height: 3em;
position: relative;
background-color: #eee;
}
.field .bubble{
display: none;
}
.field:hover .bubble{
display: block !important;
}
.field:hover strong{
color: #111;
}
strong{
color: #999;
display: block;
line-height: 3em;
width: 25%;
text-align: right;
font-weight: normal;
}
label{
position: absolute;
display: block;
top: 0;
right: 0;
left: 0;
bottom: 0;
text-align: left;
}
input{
margin: .5em 2% 0 0;
padding: 0;
font-size: 1em;
height: 1.5em;
border: none;
outline: 1px solid #ccc;
float: right;
width: 68%;
text-indent: .5em;
padding: .3em 0 .2em 0; /* Fucking Firefox! */
}
input:focus{
outline: none;
box-shadow: #0088CE 0px 0px .5em;
-moz-box-shadow: #0088CE 0px 0px .5em;
-webkit-box-shadow: #0088CE 0px 0px .5em;
}
</style>
</head>
<body>
<div class="field">
<label>
<input type="text" value="" />
<strong>Author</strong>
</label>
<div class="bubble">
<em>Author name can used to set the author of your posts.</em>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment