排版
用于控制块中文本前显示的空白空间量的工具。
¥Basic usage
¥Adding a text indent
使用 indent-*
工具设置块中文本前显示的空白空间(缩进)量。
¥Use the indent-*
utilities to set the amount of empty space (indentation) that’s shown before text in a 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. 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 <em>was</em> a marine biologist.
</p>
¥Using negative values
要使用负文本缩进值,请在类名称前加上破折号以将其转换为负值。
¥To use a negative text indent value, prefix the class name with a dash to convert it to a negative value.
<div class="-indent-8">
So I started to walk into the water. I won't lie to...
</div>
Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use hover:indent-8
to only apply the indent-8
utility on hover.
<div class="indent-4 hover:indent-8">
<!-- ... -->
</div>
For a complete list of all available state modifiers, check out the Hover, Focus, & Other States documentation.
You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use md:indent-8
to apply the indent-8
utility at only medium screen sizes and above.
<div class="indent-4 md:indent-8">
<!-- ... -->
</div>
To learn more, check out the documentation on Responsive Design, Dark Mode and other media query modifiers.
¥Using custom values
¥Customizing your theme
默认文本缩进比例基于 默认间距比例。你可以通过编辑 tailwind.config.js
文件中的 theme.spacing
或 theme.extend.spacing
来自定义间距比例。
¥The default text indent scale is based on the default spacing scale. You can customize your spacing scale by editing theme.spacing
or theme.extend.spacing
in your tailwind.config.js
file.
module.exports = {
theme: {
extend: {
spacing: {
'128': '32rem',
}
}
}
}
或者,你可以通过编辑 tailwind.config.js
文件中的 theme.textIndent
或 theme.extend.textIndent
来自定义文本缩进比例。
¥Alternatively, you can customize just the text indent scale by editing theme.textIndent
or theme.extend.textIndent
in your tailwind.config.js
file.
module.exports = {
theme: {
extend: {
textIndent: {
'128': '32rem',
}
}
}
}
在 主题定制 文档中了解有关自定义默认主题的更多信息。
¥Learn more about customizing the default theme in the theme customization documentation.
¥Arbitrary values
If you need to use a one-off text-indent
value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value.
<div class="indent-[50%]">
<!-- ... -->
</div>
Learn more about arbitrary value support in the arbitrary values documentation.