Align text and select boxes to the same width with HTML and CSS

HTMLWeb DevelopmentFront End Technology

When we set the width and height of an element in CSS then often the element appears bigger than the actual size. This is because by default, the padding and border are added to the element’s width and height and then the element is displayed.

The box sizing property includes the padding and border of an element with actual width and height so that the element does not appear bigger than the actual size. The format to use this property is “box-sizing: box-border”


You can try to run the following code to align text and select boxes to the same width −

         input, select {
            width: 250px;
            border: 2px solid #000;
            padding: 0;
            margin: 0;
            height: 22px;
            -moz-box-sizing: border-box;
            -webkit-box-sizing: border-box;
            box-sizing: border-box;
         input {
            text-indent: 3px;
      <input type = "text" value = "Name of Candidate"><br>
         <option>Select Choice</option>
Published on 20-Mar-2018 10:01:52