How to make a text area 100% width without overflowing when padding is present in CSS?

Spread the love

Sometimes, we want to make a text area 100% width without overflowing when padding is present in CSS.

In this article, we’ll look at how to make a text area 100% width without overflowing when padding is present in CSS.

How to make a text area 100% width without overflowing when padding is present in CSS?

To make a text area 100% width without overflowing when padding is present in CSS, we ser the box-sizing property to border-box.

For instance, we write

.boxsizingBorder {
  box-sizing: border-box;
}

to apply box-sizing: border-box; to the elemennts with class boxsizingBorder to make the element 100% width without overflowing when padding is present.

Conclusion

To make a text area 100% width without overflowing when padding is present in CSS, we ser the box-sizing property to border-box.

Leave a Reply

Your email address will not be published. Required fields are marked *