← All tools

CSS Tooltip Generator

Create a four-direction tooltip with configurable arrow, typography and colors.

css-tooltip-generatorLOCAL WORKSPACE

Enabling local controls…

Tool settings

The sample opens on hover and keyboard focus. Give each tooltip a unique ID and add Escape dismissal if it obscures surrounding content.

Settings stay on this page. Reloading restores the defaults.

Feature reference checked 2026-11-21 · ZeroServer

Live preview and export

CSS

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

.custom-tooltip {
  position: absolute;
  visibility: hidden;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background-color: #1e293b;
  color: #f8fafc;
  padding: 0.3em 0.5em;
  border-radius: 6px;
  font-size: 13px;
  width: max-content;
  max-width: min(8ch, 35vw);
  overflow-wrap: anywhere;
  z-index: 1;
}

.custom-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #1e293b;
}

.custom-tooltip::before {
  content: "";
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: 6px;
}

.tooltip-wrap:hover .custom-tooltip, .tooltip-wrap:focus-within .custom-tooltip {
  visibility: visible;
}

HTML

<span class="tooltip-wrap">
  <button type="button" aria-describedby="example-tooltip">Help</button>
  <span id="example-tooltip" role="tooltip" class="custom-tooltip">Tooltip</span>
</span>

How to use this tool

Choose a preset or edit the controls. Compare the live preview, then copy or download the styles and any available markup.

When not to use it

Verify contrast, placement and browser behavior in the component that will use the exported styles.