WELCOME TO AXWON GROUP

How to add Tooltip using CSS

Hover Me Hey, This is the tooltip

HTML

<div class="tooltip"><i class="far fa-question-circle toolt-ico"></i><span class="tooltiptext left height-3">We will create social media (Facebook, Instagram, YouTube & Twitter) accounts for your business.</span> </div>

CSS



<style>
/* Tooltip container */
.tooltip {
  position: relative;
  display: inline-block;
}
.tooltip .tooltiptext {font-size:13px;
    width:320px;
  visibility: hidden;
background: linear-gradient(90deg, rgba(34,0,255,0.85) 0%, rgba(94,0,255,0.85) 100%);
  color: #fff;
  text-align: left;
  padding: 6px 15px 6px 15px;
  border-radius: 8px;
  position: absolute;
  z-index: 1;
  border-bottom: solid 2px rgba(255, 255, 255, 0.49);
  backdrop-filter: saturate(180%) blur(10px);
-webkit-backdrop-filter: saturate(180%) blur(10px);
transition: .3s;
opacity: 0;
}

.tooltip:hover .tooltiptext {
  visibility: visible;
  transition: 0.3s;
  opacity:1; 
}

.left{
    margin-left:5px;
}

.right{
      right: 105%;
      margin-right:5px;
}
.tooltip .left::after {
  content: " ";
  position: absolute;
  top: 50%;
  right: 100%; /* To the left of the tooltip */
  margin-top: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: transparent rgba(34,0,255,0.85) transparent transparent;
}
.tooltip .right::after {
  content: " ";
  position: absolute;
  top: 50%;
  left: 100%; /* To the left of the tooltip */
  margin-top: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: transparent  transparent transparent
  rgba(34,0,255,0.85);
}

.tooltip .height-1{    top:-20%;}
.tooltip .height-2{    top:-68%;}
.tooltip .height-3{    top:-112%;}
.tooltip .height-4{    top:-162%;}
.tooltip .height-5{    top:-206%;}

.toolt-ico{
    color:rgba(34,0,255,0.70);
}
@media only screen and (max-width: 600px) {
.left, .right, .tooltip .tooltiptext{
    width: 260px; 
    top: 28px;
    left: -210px;
    right: 105%;
}
.right::after, .left::after{
display: none;
}
}
</style>

Leave a Comment