Skip to content

Instantly share code, notes, and snippets.

@bugsysop
Created September 28, 2012 21:16
Show Gist options
  • Select an option

  • Save bugsysop/3802122 to your computer and use it in GitHub Desktop.

Select an option

Save bugsysop/3802122 to your computer and use it in GitHub Desktop.
CSS3 hole with tooltip
<!--
Source : http://codepen.io/01miru/pen/kjsag
-->
<div class="light2"></div>
<div class="container">
<ul>
<li>
<div class="element">
<div class="tooltip">
<div class="content">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>
</div>
</div>
</li>
</ul>
</div>
html{
width: 100%;
height: 100%;
}
body{
background: url(http://miru87.mydevil.net/konsbet/images/background.png) repeat;
overflow: hidden;
width: 100%;
height: 100%;
font-family: 'Lucida Grande', Tahoma, Verdana, Arial, sans-serif;
font-size: 11px;
-webkit-perspective: 500px;
-ms-perspective: 500px;
-0-perspective: 500px;
-moz-perspective: 500px;
perspective: 500px;
}
.light2{
background: -moz-linear-gradient(top, rgba(255,255,255,0) 0%, rgba(255,255,255,0.2) 40%, rgba(255,255,255,0.2) 60%, rgba(255,255,255,0) 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,0)), color-stop(40%,rgba(255,255,255,0.2)), color-stop(60%,rgba(255,255,255,0.2)), color-stop(100%,rgba(255,255,255,0)));
background: -webkit-linear-gradient(top, rgba(255,255,255,0) 0%,rgba(255,255,255,0.2) 40%,rgba(255,255,255,0.2) 60%,rgba(255,255,255,0) 100%);
background: -o-linear-gradient(top, rgba(255,255,255,0) 0%,rgba(255,255,255,0.2) 40%,rgba(255,255,255,0.2) 60%,rgba(255,255,255,0) 100%);
background: -ms-linear-gradient(top, rgba(255,255,255,0) 0%,rgba(255,255,255,0.2) 40%,rgba(255,255,255,0.2) 60%,rgba(255,255,255,0) 100%);
background: linear-gradient(to bottom, rgba(255,255,255,0) 0%,rgba(255,255,255,0.2) 40%,rgba(255,255,255,0.2) 60%,rgba(255,255,255,0) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00ffffff', endColorstr='#00ffffff',GradientType=0 );
width:100%;
height:100%;
}
.container{
width:260px;
height: 120px;
position: absolute;
margin-top:-60px;
margin-left:-30px;
top:50%;
left:50%;
}
.container ul, .container ul li {
list-style: none;
padding: 0px;
margin: 0px;
}
.container ul li{
text-align: center;
float:left;
height: 120px;
width: 137px;
}
.container ul li .element{
width:40px;
height:40px;
margin-left:49px;
margin-top: 36px;
background:#fff;
box-shadow:inset 0 0 0 1px transparent, inset 0px 10px 7px 0px rgba(0, 0, 0, 0.7), 0px -5px 25px 2px rgba(255, 255, 255, 0.4), 0px 5px 25px 2px rgba(0, 0, 0, 0.3);
-webkit-border-radius: 10px;
border-radius: 20px;
}
.container ul li .element:hover{
cursor: pointer;
/*box-shadow:inset 0 0 0 1px rgba(255,255,255,0.7), inset 0px 10px 7px 0px rgba(0, 0, 0, 0.7);*/
}
.container ul li .element:hover .tooltip{
opacity: 1;
visibility: visible;
top: 53px;
}
.container ul li .element .tooltip{
position: relative;
width: 190px;
height: 50px;
top: 48px;
left: -2px;
opacity: 0;
visibility: hidden;
box-shadow: 0px 5px 10px -2px rgba(0, 0, 0, 0.3);
-webkit-transition: all 200ms ;
-moz-transition: all 200ms ;
-ms-transition: all 200ms ;
-o-transition: all 200ms ;
transition: all 200ms ;
transition-delay: 1s;
border-bottom: 3px solid #B9B9B9;
-webkit-border-radius: 5px;
border-radius: 5px;
background: #ffffff;
background: -moz-linear-gradient(top, #ffffff 12%, #d3d3d3 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(12%,#ffffff), color-stop(100%,#d3d3d3));
background: -webkit-linear-gradient(top, #ffffff 12%,#d3d3d3 100%);
background: -o-linear-gradient(top, #ffffff 12%,#d3d3d3 100%);
background: -ms-linear-gradient(top, #ffffff 12%,#d3d3d3 100%);
background: linear-gradient(to bottom, #ffffff 12%,#d3d3d3 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#d3d3d3',GradientType=0 );
behavior: url('css/PIE.htc');
}
.container ul li .element .tooltip .content{
font-size:11px;
color: #5a5a5a;
font-family: 'Lucida Grande', Tahoma, Verdana, Arial, sans-serif;
text-align: center;
line-height: 16px;
height: 50px;
display: table-cell;
vertical-align: middle;
width: 190px;
text-shadow: 0px 1px 0px #ffffff;
filter: dropshadow(color=#ffffff, offx=0, offy=1);
behavior: url('css/PIE.htc');
}
.container ul li .element .tooltip:before{
width: 0px;
height: 0px;
border: 10px solid transparent;
border-bottom: 10px solid white;
position: absolute;
top: -20px;
left: 13px;
content: "";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment