# Popover Toggletip

> A click-to-open info bubble using the native popover attribute, placed above its button with CSS anchor positioning.

- Category: [CSS Effects](https://copy-css.com/category/effects)
- Tags: popover, toggletip, click tooltip, anchor positioning, popovertarget, no javascript
- Live preview: https://copy-css.com/snippets/popover-toggletip
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<button class="toggletip-btn" type="button" popovertarget="toggletip-1" aria-label="More info">?</button>
<div class="toggletip" id="toggletip-1" popover>
  Free shipping on orders over $50. Returns are free within 30 days.
</div>
```

## CSS

```css
.toggletip-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: #0891b2;
  color: #fff;
  font: 700 16px system-ui, sans-serif;
  cursor: pointer;
  anchor-name: --toggletip;
}

.toggletip-btn:focus-visible {
  outline: 2px solid #0891b2;
  outline-offset: 3px;
}

.toggletip {
  width: 220px;
  padding: 12px 14px;
  border: 0;
  border-radius: 12px;
  background: #164e63;
  box-shadow: 0 12px 28px -10px rgba(8, 51, 68, 0.5);
  color: #ecfeff;
  font: 14px/1.45 system-ui, sans-serif;
}

@supports (position-area: top) {
  .toggletip {
    position-anchor: --toggletip;
    position-area: top;
    position-try-fallbacks: flip-block;
    margin: 0 0 10px;
  }
}
```

## Notes

- This CSS Popover Toggletip is 38 lines of pure CSS (0.7 KB) with no JavaScript and no dependencies. It uses anchor positioning, box shadows, CSS Grid and keyboard focus styles.
- anchor positioning: Chrome and Edge 125+, Safari 26+ and Firefox 147+. Older browsers use the @supports fallback position.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
