Typography

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>;

Examples

Basic example

Use tab-<number> utilities like tab-2 and tab-8 to control the size of tab characters:

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>

Using a custom value

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.

Responsive design

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.

Copyright © 2026 Tailwind Labs Inc.·Trademark Policy

Tailwind CSS 中文网(本网站)的目标是为中文开发者提供准确、及时的 Tailwind CSS 中文文档

Tailwind CSS 中文文档由本网站维护人员共同翻译,采用 MIT 开源协议发布

本网站与 tailwindcss.com 及 Tailwind Labs Inc. 并无从属关系

Tailwind 商标由 Tailwind Labs Inc. 所有

京ICP备15031610号-106