Created
January 9, 2012 09:09
-
-
Save PM5544/1582099 to your computer and use it in GitHub Desktop.
Tooltip from one HTML element (with :before and :after)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Tooltip from one HTML element (with :before and :after) | |
*/ | |
body{ | |
font: normal 16px/20px Verdana,sans-serif; | |
color:black; | |
} | |
.tooltip { | |
position: absolute; | |
box-shadow: 2px 3px 8pxrgba(150, 150, 150, 0.4); | |
background: white; | |
border: 1px solid #939393; | |
border-radius: 10px; | |
width: 50%; | |
top: 50%; | |
left: 50%; | |
margin:-30% auto auto -25%;; | |
padding: 15px; | |
} | |
.tooltip:before, .tooltip:after{ | |
content:""; | |
position: absolute; | |
border: 16px solid transparent; | |
left: 50%; | |
} | |
.tooltip:before { | |
border-top-color: #939393; | |
margin-left:-34px; | |
bottom: -33px; | |
} | |
.tooltip:after { | |
border-width: 15px; | |
border-top-color: white; | |
margin-left:-33px; | |
bottom: -30px; | |
border-radius: 8px; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- content to be placed inside <body>…</body> --> | |
<div class=tooltip> | |
<h1>header</h1> | |
<p>Lorizzle ipsizzle dolor sit amizzle, consectetuer adipiscing cool. Nullam sapizzle velizzle, for sure volutpizzle, yo quis, black shizznit, arcu. Pellentesque shiz tortizzle. Crunk fizzle. We gonna chung fo shizzle mah nizzle fo rizzle, mah home g-dizzle dolor dapibizzle dawg tempizzle crunk. Maurizzle pellentesque nibh my shizz. Black izzle tortizzle. Boom shackalack eleifend rhoncus fo. In away ghetto fo shizzle mah nizzle fo rizzle, mah home g-dizzle dictumst. Crackalackin fizzle. Curabitizzle sure urna, pretizzle da bomb, mattizzle izzle, shizzlin dizzle fo shizzle, nunc. Gangsta suscipit.</p> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"view":"split","prefixfree":"1","page":"css"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment