Interactivity
Utilities for controlling whether the user can select text in an element.
Class | Styles |
---|---|
select-none | user-select: none; |
select-text | user-select: text; |
select-all | user-select: all; |
select-auto | user-select: auto; |
Use the select-none
utility to prevent selecting text in an element and its children:
Try selecting the text to see the expected behavior
<div class="select-none ...">The quick brown fox jumps over the lazy dog.</div>
Use the select-text
utility to allow selecting text in an element and its children:
Try selecting the text to see the expected behavior
<div class="select-text ...">The quick brown fox jumps over the lazy dog.</div>
Use the select-all
utility to automatically select all the text in an element when a user clicks:
Try clicking the text to see the expected behavior
<div class="select-all ...">The quick brown fox jumps over the lazy dog.</div>
Use the select-auto
utility to use the default browser behavior for selecting text:
Try selecting the text to see the expected behavior
<div class="select-auto ...">The quick brown fox jumps over the lazy dog.</div>
Prefix an user-select
utility with a breakpoint variant like md:
to only apply the utility at medium screen sizes and above:
<div class="select-none md:select-all ..."> <!-- ... --></div>
Learn more about using variants in the variants documentation.
Tailwind CSS 中文网(本网站)的目标是为中文开发者提供准确、及时的 Tailwind CSS 中文文档
Tailwind CSS 中文文档由本网站维护人员共同翻译,采用 MIT 开源协议发布
本网站与 tailwindcss.com 及 Tailwind Labs Inc. 并无从属关系
Tailwind 商标由 Tailwind Labs Inc. 所有
京ICP备15031610号-8