Input field with 100% CSS width and padding - fill DIV space

Hello, how can I make an Input field to fill the full width of its parent DIV space ? I am using CSS width: 100% and also a padding for input field, but the total width is more than 100%. But I need to have the Input width exactly 100%, to display it correctly in responsive design.
0
give a positive ratinggive a negative rating
11 Jul 2022 at 03:48 PM
Hi,

To fill the full width of available space + use a padding, you have to add box-sizing: border-box; into your code.

CSS should look like:

.input {
width: 100%;
padding: 0px 15px 0px 15px;
box-sizing: border-box;
}

0
give a positive ratinggive a negative rating
26 Jul 2022 at 06:35 PM
Tim
Share on FacebookShare on TwitterShare on LinkedInSend email
x
x
Find us on Facebook
2022 AnswerTabsTermsContact us