Last active
August 29, 2015 14:17
-
-
Save sujoyu/d3a187ee3b30a2f2009f to your computer and use it in GitHub Desktop.
Tooltip(balloon annotation) implemented with only CSS3.
This file contains hidden or 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
<html> | |
<head> | |
<link rel="stylesheet" type="text/css" href="https://gist.githubusercontent.com/sujoyu/d3a187ee3b30a2f2009f/raw/5a1e111f77ae49c8173fc8574738eb9e8c3cd312/balloon-annotation.css"> | |
</head> | |
<body> | |
<br /> | |
<div class="balloon-annotation"> | |
annotation legend. | |
<p class="balloon-annotation-body">annotation body! FOOOOOOOO!!</p> | |
</div> | |
</body> | |
</html> |
This file contains hidden or 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(balloon annotation) implemented with only CSS3. | |
This design respect SCSS-Tooltip(http://hackingui.com/front-end/scss-tooltips/). | |
-- Usage -- | |
<div class="balloon-annotation"> | |
annotation legend. | |
<p class="balloon-annotation-body">annotation body! FOOOOOOOO!!</p> | |
</div> | |
*/ | |
.balloon-annotation { | |
display: inline-block; | |
color: #2785C0; | |
cursor: default; | |
} | |
.balloon-annotation > .balloon-annotation-body { | |
display: inline-block; | |
visibility: hidden; | |
position: absolute; | |
z-index: 100; | |
margin: -16px 0 0 16px; | |
padding: 16px 24px; | |
border-radius:3px; | |
box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.4); | |
background-color: #2C3E50; | |
max-width: 700px; | |
color: #FFF; | |
font-size: small; | |
font-weight: normal; | |
text-align: left; | |
line-height: 1.5em; | |
justify-content: center; | |
opacity: 0; | |
transition: opacity 200ms ease 0s, visibility 0ms linear 200ms; | |
} | |
.balloon-annotation:hover > .balloon-annotation-body { | |
visibility: visible; | |
opacity: 1; | |
transition: opacity 300ms ease 0s, visibility 0ms linear; | |
} | |
/* | |
Balloon beak. | |
*/ | |
.balloon-annotation > .balloon-annotation-body:before { | |
display: inline-block; | |
position: absolute; | |
margin-left: -30px; | |
border-width: 6px 6px 6px medium; | |
border-style: solid solid solid none; | |
border-color: transparent #2C3E50; | |
content: ""; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment