Tailwind css flex wrap

Flex

Utilities for controlling how flex items both grow and shrink.

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

div class="flex"> div class="flex-none w-14 h-14"> 01 div> div class="flex-initial w-64 . "> 02 div> div class="flex-initial w-32 . "> 03 div> div>

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

div class="flex"> div class="flex-none . "> 01 div> div class="flex-1 w-64 . "> 02 div> div class="flex-1 w-32 . "> 03 div> div>

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

div class="flex . "> div class="flex-none . "> 01 div> div class="flex-auto w-64 . "> 02 div> div class="flex-auto w-32 . "> 03 div> div>

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

div class="flex . "> div class="flex-none w-14 h-14 . "> 01 div> div class="flex-none . "> 02 div> div class="flex-1 . "> 03 div> div>

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 .

div class="flex-none hover:flex-1"> div> 

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

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.

div class="flex-none md:flex-1"> div> 

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

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.

module.exports =   theme:   extend:   flex:   '2': '2 2 0%'  >  >  >  > 

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

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.

Copyright © 2023 Tailwind Labs Inc.

Источник

Flex Wrap

Use flex-nowrap to prevent flex items from wrapping, causing inflexible items to overflow the container if necessary:

div class="flex flex-nowrap"> div>1div> div>2div> div>3div> div>

Wrap normally

div class="flex flex-wrap"> div>1div> div>2div> div>3div> div>

Wrap reversed

div class="flex flex-wrap-reverse"> div>1div> div>2div> div>3div> div>

Responsive

To control how flex items wrap at a specific breakpoint, add a : prefix to any existing utility class. For example, use md:flex-wrap-reverse to apply the flex-wrap-reverse utility at only medium screen sizes and above.

div class="flex flex-wrap md:flex-wrap-reverse . "> div>

For more information about Tailwind’s responsive design features, check out the Responsive Design documentation.

Customizing

Variants

By default, only responsive variants are generated for flex-wrap utilities. You can control which variants are generated for the flex-wrap utilities by modifying the flexWrap property in the variants section of your tailwind.config.js file. For example, this config will also generate hover and focus variants:

 // tailwind.config.js module.exports =  variants:  extend:  // . + flexWrap: [' hover ', ' focus '],  > > >

Disabling

If you don’t plan to use the flex-wrap utilities in your project, you can disable them entirely by setting the flexWrap property to false in the corePlugins section of your config file:

 // tailwind.config.js module.exports =  corePlugins:  // . + flexWrap: false,  > >

Источник

Flex Wrap

Use flex-nowrap to prevent flex items from wrapping, causing inflexible items to overflow the container if necessary:

div class="flex flex-nowrap"> div>01div> div>02div> div>03div> div>

Use flex-wrap to allow flex items to wrap:

div class="flex flex-wrap"> div>01div> div>02div> div>03div> div>

Use flex-wrap-reverse to wrap flex items in the reverse direction:

div class="flex flex-wrap-reverse"> div>01div> div>02div> div>03div> div>

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

div class="flex flex-wrap hover:flex-wrap-reverse"> div> 

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

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-wrap-reverse to apply the flex-wrap-reverse utility at only medium screen sizes and above.

div class="flex flex-wrap md:flex-wrap-reverse"> div> 

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

Copyright © 2023 Tailwind Labs Inc.

Источник

Перенос flex-элементов

Используйте flex-nowrap , чтобы предотвратить перенос flex-элементов, в результате чего flex-элементы при необходимости переполняют контейнер:

div class="flex flex-nowrap"> div>1div> div>2div> div>3div> div>

Переносить нормально

div class="flex flex-wrap"> div>1div> div>2div> div>3div> div>

Обратный перенос

div class="flex flex-wrap-reverse"> div>1div> div>2div> div>3div> div>

Адаптивность

Чтобы управлять переносом flex-элементов в определенную контрольную точку, добавьте префикс : к любому существующему классу утилиты. Например, используйте md:flex-wrap-reverse , чтобы применить утилиту flex-wrap-reverse только при средних размерах экрана и выше.

div class="flex flex-wrap md:flex-wrap-reverse . "> div>

Для получения дополнительной информации о функциях адаптивного дизайна Tailwind ознакомьтесь с документацией Адаптивного дизайна.

Кастомизация

Варианты

По умолчанию, только responsive варианты создаются для утилит flex-wrap. Вы можете контролировать, какие варианты создаются для утилит flex-wrap для изменения свойства flexWrap в разделе variants Вашего файла конфигурации tailwind.config.js . Например, эта конфигурация также будет генерировать варианты hover и focus :

 // tailwind.config.js module.exports =  variants:  extend:  // . + flexWrap: [' hover ', ' focus '],  > > >

Отключение

Если Вы не планируете использовать в своем проекте утилиты для изменения flex-wrap , Вы можете полностью отключить их, установив для flexWrap свойство значение false в разделе corePlugins Вашего файла конфигурации:

 // tailwind.config.js module.exports =  corePlugins:  // . + flexWrap: false,  > >

Источник

Flex Wrap

Use flex-nowrap to prevent flex items from wrapping, causing inflexible items to overflow the container if necessary:

div class="flex flex-nowrap"> div>1div> div>2div> div>3div> div>

Wrap normally

Use flex-wrap to allow flex items to wrap:

div class="flex flex-wrap"> div>1div> div>2div> div>3div> div>

Wrap reversed

Use flex-wrap-reverse to wrap flex items in the reverse direction:

div class="flex flex-wrap-reverse"> div>1div> div>2div> div>3div> div>

Responsive

To control how flex items wrap at a specific breakpoint, add a : prefix to any existing utility class. For example, use md:flex-wrap-reverse to apply the flex-wrap-reverse utility at only medium screen sizes and above.

div class="flex flex-wrap md:flex-wrap-reverse . "> div>

For more information about Tailwind’s responsive design features, check out the Responsive Design documentation.

Customizing

Variants

By default, only responsive variants are generated for flex-wrap utilities.

You can control which variants are generated for the flex-wrap utilities by modifying the flexWrap property in the variants section of your tailwind.config.js file.

For example, this config will also generate hover and focus variants:

 // tailwind.config.js module.exports =  variants:  extend:  // . + flexWrap: [' hover ', ' focus '],  > > >

Disabling

If you don’t plan to use the flex-wrap utilities in your project, you can disable them entirely by setting the flexWrap property to false in the corePlugins section of your config file:

 // tailwind.config.js module.exports =  corePlugins:  // . + flexWrap: false,  > >

Источник

Читайте также:  Access cookie values in php
Оцените статью