<section>
<h1>Tooltip</h1>
<div class="button">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z" />
<path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
</svg>
<div class="tooltip">
<a href="#">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M5.121 17.804A13.937 13.937 0 0112 16c2.5 0 4.847.655 6.879 1.804M15 10a3 3 0 11-6 0 3 3 0 016 0zm6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
</a>
<a href="#"><svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z" />
</svg></a>
<a href="#">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round" d="M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z" />
<path stroke-linecap="round" stroke-linejoin="round" d="M15 11a3 3 0 11-6 0 3 3 0 016 0z" />
</svg>
</a>
</div>
</div>
</section>
body {
position: relative;
width: 100%;
height: 100%;
margin: 0;
padding: 0;
background-color: rgb(36, 36, 36);
background-image: radial-gradient(
0deg,
rgb(129, 125, 121) 0%,
rgb(20, 20, 20) 150%
);
background-repeat: no-repeat;
background-position: 50% 0;
background-size: 160% 160%;
}
section {
margin: 0 auto;
padding: 50px 0;
text-align: center;
}
h1 {
font-size: 48px;
font-weight: 400;
line-height: 60px;
margin: 0 0 18px;
cursor: default;
color: rgb(223, 219, 219);
text-shadow: 0 -1px 2px rgba(0, 0, 0, 0.75);
}
.icon {
display: block;
float: left;
width: 22px;
height: 22px;
margin: 0;
padding: 0;
}
.button {
line-height: 20px;
position: relative;
display: inline-block;
margin-top: 50px;
padding: 3px 8px;
cursor: pointer;
transition: all 0.145s ease;
text-decoration: none;
color: white;
border: 1px solid rgba(0, 0, 0, 0.4);
border-radius: 5px;
background: linear-gradient(
to top,
rgba(255, 255, 255, 0) 0%,
rgba(255, 255, 255, 0.06) 75%
);
box-shadow: 0 1px 0 0 rgba(255, 255, 255, 0.15) inset,
0 1px 1px 0 rgba(255, 255, 25, 0.06);
}
.tooltip {
position: absolute;
z-index: 10;
top: -50px;
left: 50%;
display: block;
visibility: hidden;
width: 132px;
height: 36px;
margin-left: -66px;
transition: all 0.2s 0.152s ease-out;
transform: translateY(-10px);
opacity: 0;
border-radius: 3px;
box-shadow: 0 0 3px 0 rgba(0, 0, 0, 0.4), 0 3px 7px 2px rgba(0, 0, 0, 0.3);
&:before,
&:after {
position: absolute;
bottom: -9px;
left: 50%;
z-index: -1;
display: block;
width: 0;
height: 0;
margin-left: -5px;
content: "";
transition: 0.2s;
border: 5px solid transparent;
background: transparent;
}
&:before {
border-top-color: rgba(157, 148, 148, 0.8);
}
&:after {
bottom: -8px;
border-top-color: rgb(208, 203, 203);
}
}
.tooltip a {
float: left;
box-sizing: border-box;
width: 44px;
height: 36px;
color: rgb(100, 100, 100);
background: linear-gradient(
to bottom,
rgba(208, 203, 203, 1) 15%,
rgba(233, 229, 229, 1) 100%
);
box-shadow: 1px 0 1px 0 rgba(0, 0, 0, 0.15) inset,
-1px 0 1px 0 rgba(255, 255, 255, 0.5) inset,
0 1px 1px 0 rgba(255, 255, 255, 0.8) inset,
0 -1px 1px 0 rgba(157, 148, 148, 0.8) inset;
&:last-child {
border-radius: 0 4px 4px 0;
}
&:first-child {
border-radius: 4px 0 0 4px;
}
&:hover {
background: linear-gradient(
to top,
rgba(226, 223, 223, 1) -20%,
rgba(200, 192, 192, 1) 70%
);
box-shadow: 1px 0 1px 0 rgba(0, 0, 0, 0.15) inset,
-1px 0 1px 0 rgba(255, 255, 255, 0.3) inset,
0 1px 1px 0 rgba(255, 255, 255, 0.8) inset,
0 -1px 1px 0 rgba(157, 148, 148, 0.8) inset;
}
}
.button:hover {
transition: all 0.145s 0s ease-in;
background: linear-gradient(
180deg,
rgba(0, 0, 0, 0.15) 0%,
rgba(0, 0, 0, 0) 75%,
rgba(0, 0, 0, 0.1) 110%
);
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.25) inset,
0 1px 1px 0 rgba(255, 255, 25, 0.08);
}
.button:hover .tooltip {
visibility: visible;
transition: all 0.2s 0.1s ease-out;
transform: translateY(0);
opacity: 1;
}
.h-6 {
height: 22px;
margin-top: 6px;
}
.w-6 {
width: 22px;
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.