1. 排版
  2. list-style-type

排版

list-style-type

用于控制列表标记样式的实用工具。

类名样式
list-disc
list-style-type: disc;
list-decimal
list-style-type: decimal;
list-none
list-style-type: none;
list-(<自定义属性>)
list-style-type: var(<自定义属性>);
list-[<值>]
list-style-type: <值>;

示例

基本示例

使用 list-disclist-decimal 等实用工具来控制列表中标记的样式

list-disc
  • Now this is a story all about how, my life got flipped-turned upside down
  • And I'd like to take a minute just sit right there
  • I'll tell you how I became the prince of a town called Bel-Air
list-decimal
  • Now this is a story all about how, my life got flipped-turned upside down
  • And I'd like to take a minute just sit right there
  • I'll tell you how I became the prince of a town called Bel-Air
list-none
  • Now this is a story all about how, my life got flipped-turned upside down
  • And I'd like to take a minute just sit right there
  • I'll tell you how I became the prince of a town called Bel-Air
<ul class="list-disc">
<li>Now this is a story all about how, my life got flipped-turned upside down</li>
<!-- ... -->
</ul>
<ol class="list-decimal">
<li>Now this is a story all about how, my life got flipped-turned upside down</li>
<!-- ... -->
</ol>
<ul class="list-none">
<li>Now this is a story all about how, my life got flipped-turned upside down</li>
<!-- ... -->
</ul>

使用自定义值

使用 list-[<值>] 语法 来设置标记基于完全自定义的值

<ol class="list-[upper-roman] ...">
<!-- ... -->
</ol>

对于 CSS 变量,您也可以使用 list-(<自定义属性>) 语法

<ol class="list-(--my-marker) ...">
<!-- ... -->
</ol>

这只是 list-[var(<自定义属性>)] 的简写,它会自动为您添加 var() 函数。

响应式设计

前缀a list-style-type 实用工具 与断点变体(如 md:)一起使用,以便仅在中等 屏幕尺寸及以上尺寸应用该实用工具

<ul class="list-none md:list-disc ...">
<!-- ... -->
</ul>

了解有关在变体文档中使用变体的更多信息。

版权所有 © 2025 Tailwind Labs Inc.·商标政策