LoveCSS.comLoveCSS

CSS Tooltip Generator

1. Content & Position

Position
px

2. Style

px
px
px
px

3. Arrow & Motion

px
px
Animation
ms

Generated CSS

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

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 14px);
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 220px;
  padding: 6px 12px;
  background: #1e293b;
  color: #ffffff;
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.18);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease, visibility 200ms;
  z-index: 10;
}

.tooltip::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #1e293b;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease, visibility 200ms;
  z-index: 10;
}

.tooltip:hover::before,
.tooltip:hover::after,
.tooltip:focus-visible::before,
.tooltip:focus-visible::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%);
}

Generated HTML

<button class="tooltip" data-tooltip="Hi, I'm a tooltip!">
  Hover me
</button>

Presets

About CSS Tooltip Generator

Create pure-CSS tooltips without JavaScript. Choose the position, colors, arrow, spacing and entrance animation, then copy the generated HTML and CSS.

Related Tools

More free CSS generators you might like.