Flexbox & Grid
Utilities for controlling how flex items grow.
| Class | Styles |
|---|---|
grow | flex-grow: 1; |
grow-<number> | flex-grow: <number>; |
grow-[<value>] | flex-grow: <value>; |
grow-(<custom-property>) | flex-grow: var(<custom-property>); |
Use grow to allow a flex item to grow to fill any available space:
<div class="flex ..."> <div class="size-14 flex-none ...">01</div> <div class="size-14 grow ...">02</div> <div class="size-14 flex-none ...">03</div></div>Use grow-<number> utilities like grow-3 to make flex items grow proportionally based on their growth factor, allowing them to fill the available space relative to each other:
<div class="flex ..."> <div class="size-14 grow-3 ...">01</div> <div class="size-14 grow-7 ...">02</div> <div class="size-14 grow-3 ...">03</div></div>Use grow-0 to prevent a flex item from growing:
<div class="flex ..."> <div class="size-14 grow ...">01</div> <div class="size-14 grow-0 ...">02</div> <div class="size-14 grow ...">03</div></div>Use the grow-[<value>] syntax to set the flex grow factor based on a completely custom value:
<div class="grow-[25vw] ..."> <!-- ... --></div>For CSS variables, you can also use the grow-(<custom-property>) syntax:
<div class="grow-(--my-grow) ..."> <!-- ... --></div>This is just a shorthand for grow-[var(<custom-property>)] that adds the var() function for you automatically.
Prefix a flex-grow utility with a breakpoint variant like md: to only apply the utility at medium screen sizes and above:
<div class="grow md:grow-0 ..."> <!-- ... --></div>Learn more about using variants in the variants documentation.
Tailwind CSS 中文网(本网站)的目标是为中文开发者提供准确、及时的 Tailwind CSS 中文文档
Tailwind CSS 中文文档由本网站维护人员共同翻译,采用 MIT 开源协议发布
本网站与 tailwindcss.com 及 Tailwind Labs Inc. 并无从属关系
Tailwind 商标由 Tailwind Labs Inc. 所有
京ICP备15031610号-106