Các tiện ích để kiểm soát lượng khoảng trống hiển thị trước văn bản trong một block.
| Class | Styles |
|---|---|
indent-<number> | text-indent: calc(var(--spacing) * <number>); |
-indent-<number> | text-indent: calc(var(--spacing) * -<number>); |
indent-px | text-indent: 1px; |
-indent-px | text-indent: -1px; |
indent-(<custom-property>) | text-indent: var(<custom-property>); |
indent-[<value>] | text-indent: <value>; |
Sử dụng các tiện ích indent-<number> như indent-2 và indent-8 để đặt lượng khoảng trống (thụt lề) hiển thị trước văn bản trong một block:
So I started to walk into the water. I won't lie to you boys, I was terrified. But I pressed on, and as I made my way past the breakers a strange calm came over me. I don't know if it was divine intervention or the kinship of all living things but I tell you Jerry at that moment, I was a marine biologist.
<p class="indent-8">So I started to walk into the water...</p>Để sử dụng giá trị thụt lề âm, thêm dấu gạch ngang trước tên class để chuyển nó thành giá trị âm:
So I started to walk into the water. I won't lie to you boys, I was terrified. But I pressed on, and as I made my way past the breakers a strange calm came over me. I don't know if it was divine intervention or the kinship of all living things but I tell you Jerry at that moment, I was a marine biologist.
<p class="-indent-8">So I started to walk into the water...</p>Use the indent-[<value>] syntax to set the text indentation based on a completely custom value:
<p class="indent-[50%] ..."> Lorem ipsum dolor sit amet...</p>For CSS variables, you can also use the indent-(<custom-property>) syntax:
<p class="indent-(--my-indentation) ..."> Lorem ipsum dolor sit amet...</p>This is just a shorthand for indent-[var(<custom-property>)] that adds the var() function for you automatically.
Prefix a text-indent utility with a breakpoint variant like md: to only apply the utility at medium screen sizes and above:
<p class="indent-4 md:indent-8 ..."> Lorem ipsum dolor sit amet...</p>Learn more about using variants in the variants documentation.