Flex

您所在的位置:网站首页 doyouwanttoplay翻译 Flex

Flex

#Flex| 来源: 网络整理| 查看: 265

Flexbox & Grid

Flex

Utilities for controlling how flex items both grow and shrink.

​Quick referenceClassPropertiesflex-1flex: 1 1 0%; flex-autoflex: 1 1 auto; flex-initialflex: 0 1 auto; flex-noneflex: none; ​Basic usage ​Initial

Use flex-initial to allow a flex item to shrink but not grow, taking into account its initial size:

01 02 03 01 02 03 ​Flex 1

Use flex-1 to allow a flex item to grow and shrink as needed, ignoring its initial size:

01 02 03 01 02 03 ​Auto

Use flex-auto to allow a flex item to grow and shrink, taking into account its initial size:

01 02 03 01 02 03 ​None

Use flex-none to prevent a flex item from growing or shrinking:

01 02 03 01 02 03 ​Applying conditionally ​Hover, focus, and other states

Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use hover:flex-1 to only apply the flex-1 utility on hover.

For a complete list of all available state modifiers, check out the Hover, Focus, & Other States documentation.

​Breakpoints and media queries

You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use md:flex-1 to apply the flex-1 utility at only medium screen sizes and above.

To learn more, check out the documentation on Responsive Design, Dark Mode and other media query modifiers.

​Using custom values ​Customizing your theme

By default, Tailwind provides four flex utilities. You can customize these values by editing theme.flex or theme.extend.flex in your tailwind.config.js file.

tailwind.config.jsmodule.exports = { theme: { extend: { flex: { '2': '2 2 0%' } } } }

Learn more about customizing the default theme in the theme customization documentation.

​Arbitrary values

If you need to use a one-off flex value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value.

Learn more about arbitrary value support in the arbitrary values documentation.

Flex WrapFlex Grow

Copyright © 2023 Tailwind Labs Inc.

Trademark Policy

Edit this page on GitHubOn this pageQuick referenceBasic usageInitialFlex 1AutoNoneApplying conditionallyHover, focus, and other statesBreakpoints and media queriesUsing custom valuesCustomizing your themeArbitrary values

From the creators of Tailwind CSS

Make your ideas look awesome, without relying on a designer.

“This is the survival kit I wish I had when I started building apps.”Derrick Reimer, SavvyCal


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3