Max-Height

Utilities for setting the maximum height of an element

@include('_partials.class-table', [ 'scroll' => false, 'rows' => [ [ '.max-h-full', 'max-height: 100%;', "Set the element's maximum height to 100%.", ], [ '.max-h-screen', 'max-height: 100vh;', "Set the element's maximum height to 100vh.", ], ] ])

Usage

Set the maximum height of an element using the max-h-full or max-h-screen utilities.

@component('_partials.code-sample')

max-h-full
@slot('code')
max-h-full
@endslot @endcomponent

Responsive

To control the max-height of an element at a specific breakpoint, add a {screen}: prefix to any existing max-height utility.

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

@component('_partials.responsive-code-sample') @slot('none')

Target
@endslot @slot('sm')
Target
@endslot @slot('md')
Target
@endslot @slot('lg')
Target
@endslot @slot('xl')
Target
@endslot @slot('code')
Target
@endslot @endcomponent

Customizing

Max-height scale

Customize Tailwind's default max-height scale in the theme.maxHeight section of your tailwind.config.js file.

@component('_partials.customized-config', ['key' => 'theme.maxHeight'])

  • '0': '0',
  • '1/4': '25%',
  • '1/2': '50%',
  • '3/4': '75%',
  • 'full': '100%', @endcomponent

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

@include('_partials.variants-and-disabling', [ 'utility' => [ 'name' => 'max-height', 'property' => 'maxHeight', ], 'variants' => [ 'responsive', ], ])

Tailwind UI is now in early access!