用于控制元素的前行距(行高)的功能类。
使用 leading-none
、 leading-tight
、 leading-snug
、 leading-normal
、 leading-relaxed
和 leading-loose
等功能类,根据元素当前的字体大小,给它一个相对的行高。
.leading-none
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Assumenda, quia temporibus eveniet a libero incidunt suscipit laborum, rerum accusantium modi quidem, ipsam illum quis sed voluptatum quae eum fugit earum.
.leading-tight
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Assumenda, quia temporibus eveniet a libero incidunt suscipit laborum, rerum accusantium modi quidem, ipsam illum quis sed voluptatum quae eum fugit earum.
.leading-snug
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Assumenda, quia temporibus eveniet a libero incidunt suscipit laborum, rerum accusantium modi quidem, ipsam illum quis sed voluptatum quae eum fugit earum.
.leading-normal
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Assumenda, quia temporibus eveniet a libero incidunt suscipit laborum, rerum accusantium modi quidem, ipsam illum quis sed voluptatum quae eum fugit earum.
.leading-relaxed
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Assumenda, quia temporibus eveniet a libero incidunt suscipit laborum, rerum accusantium modi quidem, ipsam illum quis sed voluptatum quae eum fugit earum.
.leading-loose
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Assumenda, quia temporibus eveniet a libero incidunt suscipit laborum, rerum accusantium modi quidem, ipsam illum quis sed voluptatum quae eum fugit earum.
<p class="leading-none ...">Lorem ipsum dolor sit amet ...</p>
<p class="leading-tight ...">Lorem ipsum dolor sit amet ...</p>
<p class="leading-snug ...">Lorem ipsum dolor sit amet ...</p>
<p class="leading-normal ...">Lorem ipsum dolor sit amet ...</p>
<p class="leading-relaxed ...">Lorem ipsum dolor sit amet ...</p>
<p class="leading-loose ...">Lorem ipsum dolor sit amet ...</p>
.leading-3
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Assumenda, quia temporibus eveniet a libero incidunt suscipit laborum, rerum accusantium modi quidem, ipsam illum quis sed voluptatum quae eum fugit earum.
.leading-4
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Assumenda, quia temporibus eveniet a libero incidunt suscipit laborum, rerum accusantium modi quidem, ipsam illum quis sed voluptatum quae eum fugit earum.
.leading-5
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Assumenda, quia temporibus eveniet a libero incidunt suscipit laborum, rerum accusantium modi quidem, ipsam illum quis sed voluptatum quae eum fugit earum.
.leading-6
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Assumenda, quia temporibus eveniet a libero incidunt suscipit laborum, rerum accusantium modi quidem, ipsam illum quis sed voluptatum quae eum fugit earum.
.leading-7
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Assumenda, quia temporibus eveniet a libero incidunt suscipit laborum, rerum accusantium modi quidem, ipsam illum quis sed voluptatum quae eum fugit earum.
.leading-8
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Assumenda, quia temporibus eveniet a libero incidunt suscipit laborum, rerum accusantium modi quidem, ipsam illum quis sed voluptatum quae eum fugit earum.
.leading-9
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Assumenda, quia temporibus eveniet a libero incidunt suscipit laborum, rerum accusantium modi quidem, ipsam illum quis sed voluptatum quae eum fugit earum.
.leading-10
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Assumenda, quia temporibus eveniet a libero incidunt suscipit laborum, rerum accusantium modi quidem, ipsam illum quis sed voluptatum quae eum fugit earum.
<p class="leading-3 ...">Lorem ipsum dolor sit amet ...</p>
<p class="leading-4 ...">Lorem ipsum dolor sit amet ...</p>
<p class="leading-5 ...">Lorem ipsum dolor sit amet ...</p>
<p class="leading-6 ...">Lorem ipsum dolor sit amet ...</p>
<p class="leading-7 ...">Lorem ipsum dolor sit amet ...</p>
<p class="leading-8 ...">Lorem ipsum dolor sit amet ...</p>
<p class="leading-9 ...">Lorem ipsum dolor sit amet ...</p>
<p class="leading-10 ...">Lorem ipsum dolor sit amet ...</p>
要在特定的断点处控制元素的行高,请在任何现有的行高功能类前添加 {screen}:
前缀。例如,使用 md:leading-loose
来仅在中等大小及以上的屏幕应用 leading-loose
功能类。
<p class="leading-none md:leading-loose ...">Lorem ipsum dolor sit amet ...</p>
关于 Tailwind 的响应式设计功能的更多信息,请查看 响应式设计 文档。
默认情况下,Tailwind 提供了六个相对的和八个固定的 line-height
功能类。您可以通过定制您的 Tailwind 主题配置的 lineHeight
部分来改变、添加或删除这些功能类。
// tailwind.config.js
module.exports = {
theme: {
extend: {
lineHeight: {
+ 'extra-loose': '2.5',
+ '12': '3rem',
}
}
}
}
默认情况下, 针对 line height 功能类,只生成 responsive 变体。
您可以通过修改您的 tailwind.config.js
文件中的 variants
部分中的 lineHeight
属性来控制为 line height 功能生成哪些变体。
例如,这个配置也将生成 hover and focus 变体:
// tailwind.config.js
module.exports = {
variants: {
extend: {
// ...
+ lineHeight: ['hover', 'focus'],
}
}
}
如果您不打算在您的项目中使用 line height 功能,您可以通过在配置文件的 corePlugins
部分将 lineHeight
property to false
in the corePlugins
section of your config file:
// tailwind.config.js
module.exports = {
corePlugins: {
// ...
+ lineHeight: false,
}
}