<div class="container">
<h1>Quick <i class="qtip tip-top" data-tip="Well, tips, you know. To explain that thing below ↓">tips</i></h1>
<p>I am a simple CSS3-powered <i class="qtip tip-top" data-tip="weee!">tooltip</i>.</p>
<p>I can be on <i class="qtip tip-top" data-tip="Here it comes right on top!">top</i>, on the <i class="qtip tip-right" data-tip="Right, finally">right</i>, <br/><i class="qtip tip-left" data-tip=" Left, that's right">left</i> and, of course, on the
<i
class="qtip tip-bottom" data-tip="Yeah, bottom">bottom</i>.</p>
<p>Add CSS from this pen, the markup will look like this:</p>
<code>
<span class="hl"><i class="<span class="qclass">qtip tip-top</span>" data-tip="<span class="qcontent">Tip content</span>"></span><br/>Any text / image / element<br /><span class="hl"></i></span><br/><br/>
Available options: <span class="qclass">.tip-top</span>, <span class="qclass">.tip-left</span>, <span class="qclass">.tip-right</span> or <span class="qclass">.tip-bottom</span>
</code>
</div>
@import url('https://fonts.googleapis.com/css?family=Raleway:200,200i,400,400i,500,500i,700,700i');
/*tipped element. should be inline-block or block*/
.qtip {
display: inline-block;
position: relative;
cursor: pointer;
color: #3bb4e5;
border-bottom: 0.05em dotted #3bb4e5;
box-sizing: border-box;
font-style: normal;
transition:all .25s ease-in-out
}
.qtip:hover {color:#069;border-bottom:0.05em dotted #069}
/*the tip*/
.qtip:before {
content: attr(data-tip);
font-size: 14px;
position: absolute;
background: rgba(10, 20, 30, 0.85);
color: #fff;
line-height: 1.2em;
padding: 0.5em;
font-style: normal;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
min-width: 120px;
text-align: center;
opacity: 0;
visibility: hidden;
transition: all .3s ease-in-out;
text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
font-family: sans-serif;
letter-spacing: 0;
font-weight: 600
}
.qtip:after {
width: 0;
height: 0;
border-style: solid;
content: '';
position: absolute;
opacity: 0;
visibility: hidden;
transition: all .3s ease-in-out
}
.qtip:hover:before,
.qtip:hover:after {
visibility: visible;
opacity: 1
}
/*top*/
.qtip.tip-top:before {
top: 0;
left: 50%;
transform: translate(-50%, calc(-100% - 8px));
box-sizing: border-box;
border-radius: 3px;
}
.qtip.tip-top:after {
border-width: 8px 8px 0 8px;
border-color: rgba(10, 20, 30, 0.85) transparent transparent transparent;
top: -8px;
left: 50%;
transform: translate(-50%, 0);
}
/*bottom*/
.qtip.tip-bottom:before {
bottom: 0;
left: 50%;
transform: translate(-50%, calc(100% + 8px));
box-sizing: border-box;
border-radius: 3px;
}
.qtip.tip-bottom:after {
border-width: 0 8px 8px 8px;
border-color: transparent transparent rgba(10, 20, 30, 0.85) transparent;
bottom: -8px;
left: 50%;
transform: translate(-50%, 0);
}
/*left*/
.qtip.tip-left:before {
left: 0;
top: 50%;
transform: translate(calc(-100% - 8px), -50%);
box-sizing: border-box;
border-radius: 3px;
}
.qtip.tip-left:after {
border-width: 8px 0 8px 8px;
border-color: transparent transparent transparent rgba(10, 20, 30, 0.85);
left: -8px;
top: 50%;
transform: translate(0, -50%);
}
/*right*/
.qtip.tip-right:before {
right: 0;
top: 50%;
transform: translate(calc(100% + 8px), -50%);
box-sizing: border-box;
border-radius: 3px;
}
.qtip.tip-right:after {
border-width: 8px 8px 8px 0;
border-color: transparent rgba(10, 20, 30, 0.85) transparent transparent;
right: -8px;
top: 50%;
transform: translate(0, -50%);
}
/*some styles for this example*/
body {
background: #3bb4e5
}
.container {
padding: 1.5em;
margin: 3em auto;
background: #fff;
position: relative;
max-width: 720px;
font-size: calc(2vmin + 12px);
line-height: 1.5em;
box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.3);
font-weight: 500;
text-align:center;
font-family:'Raleway', sans-serif
}
.container p {margin:0 auto 0.8em}
.container h1 {
text-align: center;font-family: monospace, serif;
line-height:1em;
color: #d40;
margin:0 auto 0.5em;
font-size: 2.5em;
}
code {
color: #3bb4e5;
font-size: 0.8em;
padding: 1em;
background: rgb(10,20,30);
display: block;
text-align:left;
}
.hl {
color: #eb1777
}
.qcontent {
color: #ff0;
font-weight: bold
}
.qclass {
color: #dd0;
font-weight: bold
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.