max-h-64: Tailwind CSS Height class

The max-h-64 class ensures that an element does not grow beyond 16rem (256 pixels).


max-h-64

The max-h-64 class ensures that an element does not grow beyond 16rem (256 pixels). It is useful for keeping sections at a reasonable height while allowing content to fit.

Code Example

html
<div class="flex justify-center items-center">
<div class="w-96 border border-indigo-300 rounded-lg p-4 max-h-64 overflow-y-auto">
<h2 class="text-lg font-bold mb-2">Chat</h2>
<div class="space-y-2">
<p class="bg-gray-100 p-2 rounded">User 1: Hello!</p>
<p class="bg-indigo-100 p-2 rounded">User 2: Hi there!</p>
<p class="bg-gray-100 p-2 rounded">User 1: How's it going?</p>
<p class="bg-indigo-100 p-2 rounded">User 2: Great! You?</p>
<p class="bg-gray-100 p-2 rounded">User 1: Doing well, thanks!</p>
</div>
</div>
</div>

Preview

Chat

User 1: Hello!

User 2: Hi there!

User 1: How's it going?

User 2: Great! You?

User 1: Doing well, thanks!

How to Use

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

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

Responsive Usage

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

html
<div class="sm:max-h-64 md:max-h-64 lg:max-h-64">
Responsive element
</div>
  • sm:max-h-64 — applies from 640px and up
  • md:max-h-64 — applies from 768px and up
  • lg:max-h-64 — 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