a.tooltip(href="#" data-tooltip="New note from image")
View Compiled
body {
background: #FFBB02;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
font-family: Roboto;
}
.tooltip {
background: url(https://cbwconline.com/IMG/Codepen/Image.svg) center/contain no-repeat;
display: inline-block;
position: relative;
height: 36px;
width: 36px;
&:hover .inner {
top: 120%;
opacity: 1;
visibility: visible;
&:before {
visibility: visible;
transform: translate(-50%, -50%) scale(1);
transition: .3s linear;
}
}
}
.inner {
padding: 8px;
border-radius: 4px;
overflow: hidden;
color: #E6E6E6;
font-size: 14px;
white-space: nowrap;
position: absolute;
top: 100%;
left: 50%;
opacity: 0;
visibility: hidden;
transform: translateX(-50%);
transition: .3s linear;
pointer-events: none;
&:before {
content: '';
background-color: #323232;
height: 250px;
width: 250px;
border-radius: 50%;
position: absolute;
left: 50%;
top:0;
visibility: hidden;
z-index: -1;
transform: translate(-50%, -50%) scale(0.1);
transition: .3s linear, transform 0s .3s linear;
}
}
View Compiled
// Using JS is not necissary, it just simplifies the HTML.
// If you don't want to use JS, put a span with a class of `.inner` within the `.tooltip` element, and remove the `data-tooltip` attribute and put it's value within the span.
var $info = $('.tooltip');
$info.each( function () {
var dataInfo = $(this).data("tooltip");
$( this ).append('<span class="inner" >' + dataInfo + '</span>');
});
This Pen doesn't use any external CSS resources.