Browse documentation

Reference / Variants & accessibility

Pseudo-elements

Target a marker, selection, placeholder, file selector button, or a generated before or after box.

Working example

Select the sample text to see the custom foreground and background together. A decorative pseudo-element should never carry the only copy of important information.

HTML
<p class="first-letter:font-serif first-letter:text-4xl selection:bg-black selection:text-white">Paper carries a record of every impression. Select a few words to inspect the highlight.</p>

Class reference

ClassCSS declarations
marker:text-blackcolor: #000;
selection:bg-blackbackground-color: #000;
selection:text-whitecolor: #fff;
placeholder:italicfont-style: italic;
file:font-boldfont-weight: 700;
before:content-nonecontent: none; --mono-content: none;
after:content-['*']content: '*'; --mono-content: '*';
first-letter:font-boldfont-weight: 700;
View full generated CSS
Compiled CSS
@property --mono-content {
  syntax: "*";
  inherits: false;
}
.marker\:text-black::marker {
  color: #000;
}
.selection\:text-white::selection {
  color: #fff;
}
.after\:content-\[\'\*\'\]::after {
  content: '*';
  --mono-content: '*';
}
.before\:content-none::before {
  content: none;
  --mono-content: none;
}
.file\:font-bold::file-selector-button {
  font-weight: 700;
}
.first-letter\:font-bold::first-letter {
  font-weight: 700;
}
.placeholder\:italic::placeholder {
  font-style: italic;
}
.selection\:bg-black::selection {
  background-color: #000;
}