min-h-screen in Tailwind CSS



min-h-screen in Tailwind CSS means:

min-height: 100vh;

So the element’s minimum height becomes the full height of the browser viewport.

Example:

<div class="min-h-screen bg-gray-100">
  Content
</div>

This makes the <div> at least as tall as the screen.

Common use cases:

  • Full-page layouts

  • Centering content vertically

  • Sticky footer layouts

  • Hero sections

Example with centered content:

<div class="min-h-screen flex items-center justify-center">
  <h1>Hello</h1>
</div>
  • flex enables flexbox

  • items-center centers vertically

  • justify-center centers horizontally

  • min-h-screen gives the container full screen height

Difference from h-screen:

ClassMeaning
h-screenexact height = screen height
min-h-screenminimum height = screen height, can grow taller

So if content becomes larger than the screen:

  • h-screen may overflow

  • min-h-screen expands naturally and is usually safer for pages




https://chatgpt.com/s/t_6a07279539288191a9e55e34de260559

Comments

Popular posts from this blog

new Promise((resolve) => setTimeout(resolve, ms))

Ecommerce with JS