¿Cómo creo una información sobre herramientas usando CSS? | Vikalp Koshik | Septiembre 2021

Primero, necesita crear dos archivos, uno es un archivo HTML y el otro es un archivo CSS. Después de crear estos archivos, simplemente pegue los siguientes códigos en su archivo.

<div class=”section”>
<h3>Tooltip</h3>
<div id=”anim”>
<span class=”tooltip” data-tooltip=”Now, Create your own amazing tooltips”>?</span>
</div>
</div>
body {
background: #0e0a1b;
font-family: “Open Sans”;
overflow: hidden;
}
.section {
display: flex;
justify-content: center;
align-items: center;
position: relative;
width: 100%;
height: 100vh;
}
h3 {
font-size: 48px;
font-weight: 600;
color: #fff;
padding-left: 10px;
}
.tooltip {
position: relative;
background: #1687d9;
padding: 5px 18px;
margin: 5px;
font-size: 26px;
border-radius: 100%;
color: #FFF;
}
.tooltip:before,
.tooltip:after {
position: absolute;
content: ‘’;
opacity: 0;
transition: all 0.4s ease;
}
.tooltip:before {
border-width: 10px 8px 0 8px;
border-style: solid;
border-color: #1687d9 transparent transparent transparent;
top: -15px;
transform: translateY(20px);
}
.tooltip:after {
content: attr(data-tooltip);
background: #1687d9;
width: 160px;
height: 40px;
font-size: 14px;
font-weight: 400;
top: -75px;
left: -10px;
padding: 10px;
border-radius: 5px;
letter-spacing: 1px;
transform: translateY(20px);
}
.tooltip:hover::before,
.tooltip:hover::after {
opacity: 1;
transform: translateY(-2px);
}
@keyframes shake {
0% {
transform: rotate(2deg);
}
50% {
transform: rotate(-3deg);
}
70% {
transform: rotate(3deg);
}
100% {
transform: rotate(0deg);
}
}
#anim:hover {
animation: shake 500ms ease-in-out forwards;
}
Vista previa final
Previous post Mercado online en India
Next post ¿Su producto se está convirtiendo en un castillo de naipes? | Dominik Gmeiner | Septiembre 2021

Deja una respuesta