Tooltip on Hover with CSS - CodexWorld

PHOTO EMBED

Sun Jan 12 2025 20:39:15 GMT+0000 (Coordinated Universal Time)

Saved by @jekabspl #css

.tooltip {
  position: relative;
  display: inline-block;
  color: #006080;
  border-bottom: 1px dashed #006080;
}
.tooltip .tooltiptext {
  visibility: hidden;
  position: absolute;
  width: 120px;
  background-color: #555;
  color: #fff;
  text-align: center;
  padding: 5px 4px;
  border-radius: 6px;
  z-index: 1;
  opacity: 0;
  transition: opacity .6s;
}
.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
}

.tooltiptext.top {
  bottom: 125%;
  left: 50%;
  margin-left: -60px;
}
.tooltiptext.top::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #555 transparent transparent transparent;
}

.tooltiptext.right {
  top: -12px;
  left: 110%;
}
.tooltiptext.right::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 100%;
  margin-top: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: transparent #555 transparent transparent;
}

.tooltiptext.bottom {
  top: 135%;
  left: 50%;
  margin-left: -60px;
}
.tooltiptext.bottom::after {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: transparent transparent #555 transparent;
}

.tooltiptext.left {
  top: -5px;
  bottom: auto;
  right: 110%;
}
.tooltiptext.left::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 100%;
  margin-top: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: transparent transparent transparent #555;
}
content_copyCOPY

https://www.codexworld.com/code-snippets/tooltip-on-hover-with-css/