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
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;
}

Share on FacebookShare on TwitterShare on LinkedInSend email
1 answer
x
x
2024 AnswerTabsTermsContact us