Browse documentation
Reference / Variants & accessibility
Pseudo-elements
Target a marker, selection, placeholder, file selector button, or a generated before or after box.
Working example
Paper carries a record of every impression. Select a few words to inspect the highlight.
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.
<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
| Class | CSS declarations |
|---|---|
marker:text-black | color: #000; |
selection:bg-black | background-color: #000; |
selection:text-white | color: #fff; |
placeholder:italic | font-style: italic; |
file:font-bold | font-weight: 700; |
before:content-none | content: none;
--mono-content: none; |
after:content-['*'] | content: '*';
--mono-content: '*'; |
first-letter:font-bold | font-weight: 700; |
View full generated 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;
}