Typography
Utilities for controlling the font weight of an element.
Class | Styles |
---|---|
font-thin | font-weight: 100; |
font-extralight | font-weight: 200; |
font-light | font-weight: 300; |
font-normal | font-weight: 400; |
font-medium | font-weight: 500; |
font-semibold | font-weight: 600; |
font-bold | font-weight: 700; |
font-extrabold | font-weight: 800; |
font-black | font-weight: 900; |
font-(<custom-property>) | font-weight: var(<custom-property>); |
font-[<value>] | font-weight: <value>; |
Use utilities like font-thin
and font-bold
to set the font weight of an element:
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
<p class="font-light ...">The quick brown fox ...</p><p class="font-normal ...">The quick brown fox ...</p><p class="font-medium ...">The quick brown fox ...</p><p class="font-semibold ...">The quick brown fox ...</p><p class="font-bold ...">The quick brown fox ...</p>
Use the font-[<value>]
syntax to set the font weight based on a completely custom value:
<p class="font-[1000] ..."> <!-- ... --></p>
For CSS variables, you can also use the font-(<custom-property>)
syntax:
<p class="font-(--my-font-weight) ..."> <!-- ... --></p>
This is just a shorthand for font-[var(<custom-property>)]
that adds the var()
function for you automatically.
Prefix a font-weight
utility with a breakpoint variant like md:
to only apply the utility at medium screen sizes and above:
<p class="font-normal md:font-bold ..."> <!-- ... --></p>
Learn more about using variants in the variants documentation.
Use the --font-weight-*
theme variables to customize the font weight utilities in your project:
@theme { --font-weight-extrablack: 1000; }
Now the font-extrablack
utility can be used in your markup:
<div class="font-extrablack"> <!-- ... --></div>
Learn more about customizing your theme in the theme documentation.
Tailwind CSS 中文网(本网站)的目标是为中文开发者提供准确、及时的 Tailwind CSS 中文文档
Tailwind CSS 中文文档由本网站维护人员共同翻译,采用 MIT 开源协议发布
本网站与 tailwindcss.com 及 Tailwind Labs Inc. 并无从属关系
Tailwind 商标由 Tailwind Labs Inc. 所有
京ICP备15031610号-8