Golang Tutorials - Learn Go Programming with Easy Step-by-Step Guides

Explore comprehensive Golang tutorials for beginners and advanced programmers. Learn Go programming with easy-to-follow, step-by-step guides, examples, and practical tips to master Go language quickly.

Width Height Min Max in TailwindCSS

Width Height Min Max in TailwindCSS

? Width, Height, Min & Max Utilities in Tailwind CSS

Tailwind provides easy-to-use utilities to control the width, height, minimum, and maximum sizes of elements.


1. Width (w-*)

Set element width with fixed sizes, percentages, fractions, and full.

ClassCSS EquivalentDescription
w-0width: 0;Zero width
w-1 to w-64width: 0.25rem to 16remFixed widths (4px to 256px)
w-autowidth: auto;Default width
w-pxwidth: 1px;1 pixel width
w-fullwidth: 100%;Full width of parent
w-screenwidth: 100vw;Full viewport width
w-1/2, w-1/3, w-2/3, w-1/4, ...width: 50%; 33.333%; etc.Fractional widths

2. Height (h-*)

Set element height similarly.

ClassCSS EquivalentDescription
h-0height: 0;Zero height
h-1 to h-64height: 0.25rem to 16remFixed heights (4px to 256px)
h-autoheight: auto;Default height
h-pxheight: 1px;1 pixel height
h-fullheight: 100%;Full height of parent
h-screenheight: 100vh;Full viewport height

3. Min-Width (min-w-*)

Set the minimum width to prevent shrinking.

ClassCSS EquivalentDescription
min-w-0min-width: 0;Minimum width zero
min-w-fullmin-width: 100%;Minimum width full parent
min-w-minmin-width: min-content;Minimum content width
min-w-maxmin-width: max-content;Maximum content width

4. Min-Height (min-h-*)

ClassCSS EquivalentDescription
min-h-0min-height: 0;Minimum height zero
min-h-fullmin-height: 100%;Minimum height full parent
min-h-screenmin-height: 100vh;Minimum height viewport

5. Max-Width (max-w-*)

Control maximum element width.

ClassCSS EquivalentDescription
max-w-xsmax-width: 20rem; (320px)Extra small max width
max-w-smmax-width: 24rem; (384px)Small max width
max-w-mdmax-width: 28rem; (448px)Medium max width
max-w-lgmax-width: 32rem; (512px)Large max width
max-w-xlmax-width: 36rem; (576px)Extra large max width
max-w-2xlmax-width: 42rem; (672px)2XL max width
max-w-fullmax-width: 100%;Full width
max-w-nonemax-width: none;No max width

6. Max-Height (max-h-*)

Control maximum height.

ClassCSS EquivalentDescription
max-h-0max-height: 0;Zero max height
max-h-fullmax-height: 100%;Max height full parent
max-h-screenmax-height: 100vh;Max height viewport

Example Usage

<div class="w-1/2 h-64 bg-blue-200 p-4">  <p>Width 50% of parent, fixed height 16rem (256px).</p></div><div class="min-w-full max-w-lg bg-green-200 p-4 mt-4">  <p>Minimum full width but max 32rem width.</p></div>

If you'd like, I can provide responsive width/height examples or explain custom sizes via Tailwind config!

Disclaimer for AI-Generated Content:
The content provided in these tutorials is generated using artificial intelligence and is intended for educational purposes only.
html
docker
php
kubernetes
golang
mysql
postgresql
mariaDB
sql