Sun Jul 31 2022
Custom Tooltips
CSS1291 views
File Name: custom-tooltips-in-css.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Custom Tooltips</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Poppins&display=swap" rel="stylesheet">
<style>
* {
margin: 0;
padding: 0;
font-family: 'Poppins', sans-serif;
}
body {
background-color: #fafafa;
}
section {
width: 100%;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
a.tooltips {
color: #000;
font-size: 25px;
text-decoration: none;
border-bottom: #ff0000 dotted 2px;
padding-bottom: 3px;
cursor: pointer;
position: relative;
}
a.tooltips::before {
position: absolute;
content: attr(data-info);
color: #fff;
background-color: rgba(24,24,24,0.8);
width: 100%;
text-align: center;
font-size: 20px;
padding: 5px 0;
border-radius: 5px;
opacity: 0;
transform: translateY(0px);
transition: 0.2s all cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
a.tooltips::after {
position: absolute;
content: '';
border-left: transparent solid 15px;
border-right: transparent solid 15px;
border-top: rgba(14,14,14,0.8) solid 15px;
left: 42%;
opacity: 0;
transition: 0.1s all cubic-bezier(0.175, 0.885, 0.32, 1.275);
transform: translateY(-30px);
}
a.tooltips:hover::before {
opacity: 1;
transform: translateY(-57px);
}
a.tooltips:hover::after {
opacity: 1;
transform: translateY(-17px);
}
</style>
</head>
<body>
<section>
<a href="" data-info="Learn Web Design" class="tooltips">www.geekboots.com</a>
</section>
</body>
</html>
Result Screenshot(s)
Author:Geekboots