# Spoiler Text

> Blurred spoiler text that comes into focus on hover, tap or keyboard focus, like on forums and chats.

- Category: [CSS Text Effects](https://copy-css.com/category/text)
- Tags: blur, hidden, reveal, censor, forum
- Live preview: https://copy-css.com/snippets/spoiler-text
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<p class="spoiler-note">The killer was <span class="spoiler-blur" tabindex="0">the butler</span>.</p>
```

## CSS

```css
.spoiler-note {
  max-width: 14em;
  margin: 0;
  color: #0f172a;
  font: 500 22px/1.5 system-ui, sans-serif;
}

.spoiler-blur {
  padding: 0 0.2em;
  border-radius: 0.3em;
  background: #e2e8f0;
  color: transparent;
  text-shadow: 0 0 0.35em #0f172a;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  cursor: pointer;
  transition: color 0.25s ease, text-shadow 0.25s ease;
}

.spoiler-blur:hover,
.spoiler-blur:focus {
  color: inherit;
  text-shadow: none;
}

.spoiler-blur:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}
```

## Notes

- This CSS Spoiler Text is 29 lines of pure CSS (0.6 KB) with no JavaScript and no dependencies. It uses transitions, text shadows and keyboard focus styles.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
