Revision - CSS Tooltip

Uses link's title attribute

by andfinally

HTML

<p>asdf</p>
<p>asdf</p>
<p>asdf</p>
<p>asdf</p>
<p>asdf</p>
<p>adsf</p>
<a href="#" title="This is information for our tooltip" class="tooltip">Hello World</a>
<p></p>
<p></p>

CSS

.tooltip {
  display: inline;
  position: relative;
}


/* Tooltip takes content from title attribute of link */

.tooltip:hover:after {
  position: absolute;
  z-index: 98;
  width: 200px;
  padding: 5px 15px;
  content: attr(title);
  background: #333;
  background: rgba(0, 0, 0, .8);
  color: #fff;
  border-radius: 5px;
  bottom: 26px;
  left: 20%;
}


/* Arrow on the bottom */

.tooltip:hover:before {
  border: solid;
  border-color: #333 transparent;
  border-width: 6px 6px 0 6px;
  bottom: 20px;
  content: "";
  left: 50%;
  position: absolute;
  z-index: 99;
}