How to get equal width of the input and select fields with CSS?

Spread the love

Sometimes, we want to get equal width of the input and select fields with CSS.

In this article, we’ll look at how to get equal width of the input and select fields with CSS.

How to get equal width of the input and select fields with CSS?

To get equal width of the input and select fields with CSS, we set the box-sizing property.

For instance, we write

input,
select {
  -ms-box-sizing: content-box;
  -moz-box-sizing: content-box;
  -webkit-box-sizing: content-box;
  box-sizing: content-box;
}

to set box-sizing to content-box to make the input and select elements have equal width.

Conclusion

To get equal width of the input and select fields with CSS, we set the box-sizing property.

Leave a Reply

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