2017-10-23 16:27:11 -04:00
---
extends: _layouts.markdown
2017-10-24 08:51:29 -04:00
title: "Display – Flexbox"
2017-10-27 08:05:44 -04:00
category: "Flexbox"
2017-10-23 16:27:11 -04:00
---
2017-10-24 08:51:29 -04:00
# Display
2017-10-23 16:27:11 -04:00
2017-10-29 16:47:18 -04:00
< div class = "text-xl text-slate-light mb-4" >
2017-10-27 13:53:01 -04:00
Utilities for creating flex containers.
< / div >
2017-10-29 16:47:18 -04:00
@include ('_partials.feature-badges', [
'responsive' => true,
'customizable' => false,
'hover' => false,
'focus' => false
])
< div class = "border-t border-grey-lighter" >
< table class = "w-full text-left" style = "border-collapse: collapse;" >
< colgroup >
< col class = "w-1/4" >
< col class = "w-1/4" >
< col class = "w-1/2" >
< / colgroup >
< thead >
< tr >
< th class = "text-sm font-semibold text-grey-darker p-2 bg-grey-lightest" > Class< / th >
< th class = "text-sm font-semibold text-grey-darker p-2 bg-grey-lightest" > Properties< / th >
< th class = "text-sm font-semibold text-grey-darker p-2 bg-grey-lightest" > Description< / th >
< / tr >
< / thead >
< tbody class = "align-baseline" >
< tr >
< td class = "p-2 border-t border-smoke-light font-mono text-xs text-purple-dark" > .flex< / td >
< td class = "p-2 border-t border-smoke-light font-mono text-xs text-blue-dark" > display: flex;< / td >
< td class = "p-2 border-t border-smoke-light text-sm text-grey-darker" > Create a block-level flex container.< / td >
< / tr >
< tr >
< td class = "p-2 border-t border-smoke-light font-mono text-xs text-purple-dark" > .inline-flex< / td >
< td class = "p-2 border-t border-smoke-light font-mono text-xs text-blue-dark" > display: inline-flex;< / td >
< td class = "p-2 border-t border-smoke-light text-sm text-grey-darker" > Create an inline flex container.< / td >
< / tr >
< / tbody >
< / table >
2017-10-23 16:27:11 -04:00
< / div >
2017-10-29 16:47:18 -04:00
## Examples
2017-10-27 13:53:01 -04:00
### Flex
2017-10-23 16:27:11 -04:00
Use `.flex` to create a block-level flex container:
@component ('_partials.code-sample')
< div class = "flex bg-smoke-light" >
< div class = "flex-1 text-slate text-center bg-smoke px-4 py-2 m-2" > 1< / div >
< div class = "flex-1 text-slate text-center bg-smoke px-4 py-2 m-2" > 2< / div >
< div class = "flex-1 text-slate text-center bg-smoke px-4 py-2 m-2" > 3< / div >
< / div >
@endcomponent
2017-10-27 13:53:01 -04:00
### Inline flex
2017-10-23 16:27:11 -04:00
Use `.inline-flex` to create an inline flex container:
@component ('_partials.code-sample')
< div class = "inline-flex bg-smoke-light" >
< div class = "flex-1 text-slate text-center bg-smoke px-4 py-2 m-2" > 1< / div >
< div class = "flex-1 text-slate text-center bg-smoke px-4 py-2 m-2" > 2< / div >
< div class = "flex-1 text-slate text-center bg-smoke px-4 py-2 m-2" > 3< / div >
< / div >
@endcomponent
2017-10-27 13:53:01 -04:00
## Responsive
To control the display property of an element at a specific breakpoint, add a `{breakpoint}:` prefix to any existing display utility class. For example, use `md:inline-flex` to apply the `inline-flex` utility at only medium screen sizes and above.
For more information about Tailwind's responsive design features, check out the [Responsive Design ](# ) documentation.
@component ('_partials.responsive-code-sample')
@slot ('none')
< div class = "flex bg-smoke-light" >
< div class = "flex-1 text-slate text-center bg-smoke px-4 py-2 m-2" > 1< / div >
< div class = "flex-1 text-slate text-center bg-smoke px-4 py-2 m-2" > 2< / div >
< div class = "flex-1 text-slate text-center bg-smoke px-4 py-2 m-2" > 3< / div >
< / div >
@endslot
@slot ('sm')
< div class = "inline-flex bg-smoke-light" >
< div class = "flex-1 text-slate text-center bg-smoke px-4 py-2 m-2" > 1< / div >
< div class = "flex-1 text-slate text-center bg-smoke px-4 py-2 m-2" > 2< / div >
< div class = "flex-1 text-slate text-center bg-smoke px-4 py-2 m-2" > 3< / div >
< / div >
@endslot
@slot ('md')
< div class = "block bg-smoke-light" >
< div class = "flex-1 text-slate text-center bg-smoke px-4 py-2 m-2" > 1< / div >
< div class = "flex-1 text-slate text-center bg-smoke px-4 py-2 m-2" > 2< / div >
< div class = "flex-1 text-slate text-center bg-smoke px-4 py-2 m-2" > 3< / div >
< / div >
@endslot
@slot ('lg')
< div class = "hidden bg-smoke-light" >
< div class = "flex-1 text-slate text-center bg-smoke px-4 py-2 m-2" > 1< / div >
< div class = "flex-1 text-slate text-center bg-smoke px-4 py-2 m-2" > 2< / div >
< div class = "flex-1 text-slate text-center bg-smoke px-4 py-2 m-2" > 3< / div >
< / div >
@endslot
@slot ('xl')
< div class = "flex bg-smoke-light" >
< div class = "flex-1 text-slate text-center bg-smoke px-4 py-2 m-2" > 1< / div >
< div class = "flex-1 text-slate text-center bg-smoke px-4 py-2 m-2" > 2< / div >
< div class = "flex-1 text-slate text-center bg-smoke px-4 py-2 m-2" > 3< / div >
< / div >
@endslot
@slot ('code')
< div class = "none:flex sm:inline-flex md:block lg:hidden xl:flex ..." >
<!-- ... -->
< / div >
@endslot
@endcomponent