max-h-16: Tailwind CSS Height class

The max-h-16 class limits the maximum height of an element to 4rem (64 pixels).


max-h-16

The max-h-16 class limits the maximum height of an element to 4rem (64 pixels). This is useful when you need to ensure elements don’t exceed a certain size.

Code Example

html
<div class="flex justify-center items-center bg-indigo-100 mt-2 rounded-t">
<div class="relative">
<button class="bg-indigo-500 text-white px-4 py-2 rounded">Menu</button>
<ul class="absolute w-40 bg-white shadow-lg rounded max-h-12 overflow-y-auto">
<li class="p-2 hover:bg-indigo-200 cursor-pointer font-medium">Option 1</li>
<li class="p-2 hover:bg-indigo-200 cursor-pointer font-medium">Option 2</li>
<li class="p-2 hover:bg-indigo-200 cursor-pointer font-medium">Option 3</li>
<li class="p-2 hover:bg-indigo-200 cursor-pointer font-medium">Option 4</li>
</ul>
</div>
</div>

Preview

  • Option 1
  • Option 2
  • Option 3
  • Option 4

How to Use

Add the max-h-16 class directly to your HTML element:

html
<div class="max-h-16">
<!-- Your content here -->
</div>

Responsive Usage

Use Tailwind's responsive prefixes to apply max-h-16 at specific breakpoints:

html
<div class="sm:max-h-16 md:max-h-16 lg:max-h-16">
Responsive element
</div>
  • sm:max-h-16 — applies from 640px and up
  • md:max-h-16 — applies from 768px and up
  • lg:max-h-16 — applies from 1024px and up

Customization

You can extend or override this utility in your tailwind.config.js. See the Tailwind CSS documentation for details on customizing your theme.

Windframe is an AI visual editor for rapidly building stunning web UIs & websites

Start building stunning web UIs & websites!

Build from scratch or select prebuilt tailwind templates