排版

tab-size

Utilities for controlling the size of tab characters.

ClassStyles
tab-<number>
tab-size: <number>;
tab-(<custom-property>)
tab-size: var(<custom-property>);
tab-[<value>]
tab-size: <value>;

示例

基本示例

使用 tab-<number> 工具类,例如 tab-2tab-8,来控制制表符的大小:

tab-2
function indent() {	return 'tabbed';}
tab-8
function indent() {	return 'tabbed';}
<pre class="tab-2 ...">function indent() {&#10;&#9;return 'tabbed'&#10;}</pre><pre class="tab-8 ...">function indent() {&#10;&#9;return 'tabbed'&#10;}</pre>

使用自定义值

Use the tab-[<value>] syntax to set the tab size based on a completely custom value:

<pre class="tab-[12px] ...">  <!-- ... --></pre>

For CSS variables, you can also use the tab-(<custom-property>) syntax:

<pre class="tab-(--my-tab-size) ...">  <!-- ... --></pre>

This is just a shorthand for tab-[var(<custom-property>)] that adds the var() function for you automatically.

响应式设计

Prefix a tab-size utility with a breakpoint variant like md: to only apply the utility at medium screen sizes and above:

<pre class="tab-4 md:tab-8 ...">  <!-- ... --></pre>

Learn more about using variants in the variants documentation.