Tooltip with pure CSS

by piiantom

HTML

<p>We have transitioned the publication of CAST AIP documentation. <a href="#" aria-label="Hello all" tooltip="Hello, i am a tooltip">Atlassian Confluence </a> to provide you with a better overall user-experience. We have provided a <span tooltip="This is another tooltip">glossary</span> to help you.</p>

CSS

body:hover{color: blue;}

a {
  color: #900;
  text-decoration: none;
}
span {color: green;}

a:hover,span:hover {
  color: red;
  position: relative;
}

a[tooltip]:hover:after, span[tooltip]:hover:after {
  content: attr(aria-label);
  padding: 4px 8px;
  color: #fff;
  position: absolute;
  left: 4px;
  top: 100%;
  white-space: nowrap;
  z-index: 1000;
  border-radius: 4px;
  box-shadow: 0px 0px 4px rgba(0,0,0,0.2);
 background-color:#000;
}

a[tooltip]:hover:after, span[tooltip]:hover:after{
  opacity: 0;
  animation-duration: 0.5s;
  animation-name: fadein;
   animation-delay: 1.5s;
   animation-fill-mode:forwards
}

@keyframes fadein {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}