venis
venis

Reputation: 31

How to add fix height and width in pixels of div in tailwind CSS?

I am working with react and tailwind css. I want to give 100px height and width to my div. If anyone have an idea how to do it in tailwind css please help me. Thanks in advance.

Upvotes: 2

Views: 6164

Answers (2)

Shubham
Shubham

Reputation: 1

Use h-[number] or h-px to set an element to a fixed height. Use w-[number] or w-px to set an element to a fixed width.

Upvotes: 0

MrPatel2021
MrPatel2021

Reputation: 211

In your div tag you need to add classes for height and width. In tailwind-css we can give fix height and width using [] (square brackets). Like,

<div className="h-[100px] w-[100-px]">Your Content</div>

Upvotes: 5

Related Questions