Use Cases
-
Force mobile devices to display native tooltips for content, instead of elements like `` just plain not working at all.
```css
abbr[title] {
show-tooltip: always;
}
```
This has advantages as a native solution, so the web page needn’t recreate complex visibility logic. (“Does the entire tooltip fit on the screen?” is a question most tooltip libraries struggle with, and a pure CSS solution can’t do it at all.)
-
Implementing custom tooltips, so you can use `title` semantically and as a fallback, without having the dreaded double-tooltip. (GitHub's style guide currently uses `aria-label` for exactly this purpose, which has problems.)
<button> <img src="help.png" alt="Help" title="This form allows JPEG and PNG uploads." /> </button>
.help-sign { show-tooltip: never; position: relative; } .help-sign:hover::before, .help-sign:focus::before { content: attr(title); display: block; position: absolute; left: 50%; /* etc. */ }
- Suppressing unwanted tooltips when using SVG's `` element for accessible names.
<svg> <title>A bar chart showing buzzwords increasing over the past year.</title> <!-- ... --> </svg>
svg|title { show-tooltip: never; }
Syntax
The property show-tooltip
takes the values always
, never
, and auto
(for overriding back to normal behavior).