Tailwind CSS Width (original) (raw)

Last Updated : 23 Jul, 2025

This class accepts lots of values in tailwind CSS in which all the properties are covered as in class form. It is the alternative to the CSS Width Property. This class is used to set the width of the text, images. The width can be assigned to the text and images in the form of pixels(px), percentage(%), centimeter(cm), etc.

**Width Classes

**Note: You can change the number with the valid "rem" values or set the percentage value.

**Syntax:

...

**Example:

HTML `

GeeksforGeeks

<p><b>Tailwind CSS Width Class</b></p>

<div class="flex">
    <div class="w-1/2 bg-green-600 h-12 rounded-l-lg">
        w-1/2
    </div>
    <div class="w-1/2 bg-green-300 h-12 rounded-r-lg">
        w-1/2
    </div>
</div>

<div class="flex ...">
    <div class="w-2/5 bg-green-600 h-12 rounded-l-lg">
        w-2/5
    </div>
    <div class="w-3/5 bg-green-300 h-12 rounded-r-lg">
        w-3/5
    </div>
</div>

<div class="flex ...">
    <div class="w-1/3 bg-green-600 h-12 rounded-l-lg">
        w-1/3
    </div>
    <div class="w-2/3 bg-green-300 h-12 rounded-r-lg">
        w-2/3
    </div>
</div>

<div class="flex ...">
    <div class="w-1/4 bg-green-600 h-12 rounded-l-lg">
        w-1/4
    </div>
    <div class="w-3/4 bg-green-300 h-12 rounded-r-lg">
        w-3/4
    </div>
</div>

<div class="flex ...">
    <div class="w-1/5 bg-green-600 h-12 rounded-l-lg">
        w-1/5
    </div>
    <div class="w-4/5 bg-green-300 h-12 rounded-r-lg">
        w-4/5
    </div>
</div>

<div class="flex ...">
    <div class="w-1/6 bg-green-600 h-12 rounded-l-lg">
        w-1/6
    </div>
    <div class="w-5/6 bg-green-300 h-12 rounded-r-lg">
        w-5/6
    </div>
</div>

<div class="w-full bg-green-300 h-12 rounded-lg">
    w-full
</div>

`

**Output: