Tipografía
Utilidades para controlar el contenido de los pseudo-elementos before y after.
| Clase | Estilos |
|---|---|
content-[<value>] | content: <value>; |
content-(<custom-property>) | content: var(<custom-property>); |
content-none | content: none; |
Usa la sintaxis content-[<value>], junto con las variantes before y after, para establecer el contenido de los pseudo-elementos ::before y ::after:
<p>Higher resolution means more than just a better-quality image. With aRetina 6K display, <a class="text-blue-600 after:content-['_↗']" href="...">Pro Display XDR</a> gives you nearly 40 percent more screen real estate thana 5K display.</p>Use the content-[attr(<name>)] syntax to reference a value stored in an attribute using the attr() CSS function:
<p before="Hello World" class="before:content-[attr(before)] ..."> <!-- ... --></p>Since whitespace denotes the end of a class in HTML, replace any spaces in an arbitrary value with an underscore:
<p class="before:content-['Hello_World'] ..."></p>If you need to include an actual underscore, you can do this by escaping it with a backslash:
<p class="before:content-['Hello\_World']"></p>Use the content-(<custom-property>) syntax to control the contents of the ::before and ::after pseudo-elements using a CSS variable:
<p class="content-(--my-content)"></p>This is just a shorthand for content-[var(<custom-property>)] that adds the var() function for you automatically.
Prefija una utilidad content con una variante de breakpoint como md: para aplicar la utilidad solo en tamaños de pantalla medium y superiores:
<p class="before:content-['Mobile'] md:before:content-['Desktop'] ..."></p>Aprende más sobre el uso de variantes en la documentación de variantes.