2017-10-23 16:27:11 -04:00
---
extends: _layouts.markdown
2017-10-27 08:05:44 -04:00
title: "Align Items - Flexbox"
category: "Flexbox"
2017-10-23 16:27:11 -04:00
---
# Align Items
2017-10-29 19:38:57 -04:00
< div class = "text-xl text-slate-light mb-4" >
2017-10-27 13:32:15 -04:00
Utilities for controlling how flex items are positioned along a container's cross axis.
< / div >
2017-10-29 19:38:57 -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/5" >
< col class = "w-1/3" >
< col >
< / 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" > .items-start< / td >
< td class = "p-2 border-t border-smoke-light font-mono text-xs text-blue-dark" > align-items: flex-start;< / td >
< td class = "p-2 border-t border-smoke-light text-sm text-grey-darker" > Align items against the start of the cross axis.< / td >
< / tr >
< tr >
< td class = "p-2 border-t border-smoke-light font-mono text-xs text-purple-dark" > .items-center< / td >
< td class = "p-2 border-t border-smoke-light font-mono text-xs text-blue-dark" > align-items: center;< / td >
< td class = "p-2 border-t border-smoke-light text-sm text-grey-darker" > Align items along the center of the cross axis.< / td >
< / tr >
< tr >
< td class = "p-2 border-t border-smoke-light font-mono text-xs text-purple-dark" > .items-end< / td >
< td class = "p-2 border-t border-smoke-light font-mono text-xs text-blue-dark" > align-items: flex-end;< / td >
< td class = "p-2 border-t border-smoke-light text-sm text-grey-darker" > Align items against the end of the cross axis.< / td >
< / tr >
< tr >
< td class = "p-2 border-t border-smoke-light font-mono text-xs text-purple-dark" > .items-baseline< / td >
< td class = "p-2 border-t border-smoke-light font-mono text-xs text-blue-dark" > align-items: space-between;< / td >
< td class = "p-2 border-t border-smoke-light text-sm text-grey-darker" > Align the baselines of each item.< / td >
< / tr >
< / tbody >
< / table >
2017-10-23 16:27:11 -04:00
< / div >
2017-10-27 13:32:15 -04:00
### Stretch <span class="ml-2 font-semibold text-slate-light text-sm uppercase tracking-wide">Default</span>
2017-10-23 16:27:11 -04:00
2017-10-24 09:43:41 -04:00
Use `.items-stretch` to stretch items to fill the flex container's cross axis:
2017-10-23 16:27:11 -04:00
@component ('_partials.code-sample')
< div class = "flex items-stretch bg-smoke-light h-24" >
< 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:32:15 -04:00
### Start
2017-10-23 16:27:11 -04:00
Use `.items-start` to align items to the start of the flex container's cross axis:
@component ('_partials.code-sample')
< div class = "flex items-start bg-smoke-light h-24" >
< 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:32:15 -04:00
### Center
2017-10-23 16:27:11 -04:00
2017-10-24 09:43:41 -04:00
Use `.items-center` to align items along the center of the flex container's cross axis:
2017-10-23 16:27:11 -04:00
@component ('_partials.code-sample')
2017-10-24 09:43:41 -04:00
< div class = "flex items-center bg-smoke-light h-24" >
2017-10-23 16:27:11 -04:00
< 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:32:15 -04:00
### End
2017-10-23 16:27:11 -04:00
2017-10-24 09:43:41 -04:00
Use `.items-end` to align items to the end of the flex container's cross axis:
2017-10-23 16:27:11 -04:00
@component ('_partials.code-sample')
2017-10-24 09:43:41 -04:00
< div class = "flex items-end bg-smoke-light h-24" >
2017-10-23 16:27:11 -04:00
< 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-24 09:43:41 -04:00
2017-10-27 13:32:15 -04:00
### Baseline
2017-10-23 16:27:11 -04:00
Use `.items-baseline` to align items along the flex container's cross axis such that all of their baselines align:
@component ('_partials.code-sample')
< div class = "flex items-baseline bg-smoke-light h-24" >
< div class = "flex-1 text-slate text-center bg-smoke px-4 py-2 m-2 text-base" > 1< / div >
< div class = "flex-1 text-slate text-center bg-smoke px-4 py-2 m-2 text-2xl" > 2< / div >
< div class = "flex-1 text-slate text-center bg-smoke px-4 py-2 m-2 text-lg" > 3< / div >
< / div >
@endcomponent
2017-10-27 13:32:15 -04:00
## Responsive
2017-10-27 13:41:48 -04:00
To control the alignment of flex items at a specific breakpoint, add a `{breakpoint}:` prefix to any existing utility class. For example, use `md:items-center` to apply the `items-center` utility at only medium screen sizes and above.
2017-10-27 13:32:15 -04:00
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 items-stretch bg-smoke-light h-24" >
< div class = "flex-1 text-slate text-center bg-smoke px-4 py-2 m-2 text-base" > 1< / div >
< div class = "flex-1 text-slate text-center bg-smoke px-4 py-2 m-2 text-2xl" > 2< / div >
< div class = "flex-1 text-slate text-center bg-smoke px-4 py-2 m-2 text-lg" > 3< / div >
< / div >
@endslot
@slot ('sm')
< div class = "flex items-start bg-smoke-light h-24" >
< div class = "flex-1 text-slate text-center bg-smoke px-4 py-2 m-2 text-base" > 1< / div >
< div class = "flex-1 text-slate text-center bg-smoke px-4 py-2 m-2 text-2xl" > 2< / div >
< div class = "flex-1 text-slate text-center bg-smoke px-4 py-2 m-2 text-lg" > 3< / div >
< / div >
@endslot
@slot ('md')
< div class = "flex items-center bg-smoke-light h-24" >
< div class = "flex-1 text-slate text-center bg-smoke px-4 py-2 m-2 text-base" > 1< / div >
< div class = "flex-1 text-slate text-center bg-smoke px-4 py-2 m-2 text-2xl" > 2< / div >
< div class = "flex-1 text-slate text-center bg-smoke px-4 py-2 m-2 text-lg" > 3< / div >
< / div >
@endslot
@slot ('lg')
< div class = "flex items-end bg-smoke-light h-24" >
< div class = "flex-1 text-slate text-center bg-smoke px-4 py-2 m-2 text-base" > 1< / div >
< div class = "flex-1 text-slate text-center bg-smoke px-4 py-2 m-2 text-2xl" > 2< / div >
< div class = "flex-1 text-slate text-center bg-smoke px-4 py-2 m-2 text-lg" > 3< / div >
< / div >
@endslot
@slot ('xl')
< div class = "flex items-baseline bg-smoke-light h-24" >
< div class = "flex-1 text-slate text-center bg-smoke px-4 py-2 m-2 text-base" > 1< / div >
< div class = "flex-1 text-slate text-center bg-smoke px-4 py-2 m-2 text-2xl" > 2< / div >
< div class = "flex-1 text-slate text-center bg-smoke px-4 py-2 m-2 text-lg" > 3< / div >
< / div >
@endslot
@slot ('code')
2017-10-27 13:41:48 -04:00
< div class = "none:items-stretch sm:items-start md:items-center lg:items-end xl:items-baseline ..." >
2017-10-27 13:32:15 -04:00
<!-- ... -->
< / div >
@endslot
@endcomponent