← 全部工具

CSS 工具提示產生器

建立四方位工具提示,可調整箭頭、字級與色彩。

css-tooltip-generator本機處理

正在啟用本機工具…

工具設定

範例在滑鼠懸停或鍵盤聚焦時顯示。請給各個提示獨立的 ID,遮住鄰近內容時再加入 Escape 關閉操作。

設定只留在本頁。重新載入後會恢復預設值。

功能參考查閱日期 2026-11-21 · ZeroServer

即時預覽與匯出

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">說明</button>
  <span id="example-tooltip" role="tooltip" class="custom-tooltip">提示文字</span>
</span>

如何使用這個工具

選擇預設或修改設定,查看即時預覽,再複製或下載樣式,以及可用的標記。

不適合用在什麼情況

請在實際使用匯出樣式的元件驗證色彩對比、位置及瀏覽器行為。