How to make textarea / input, which has a 10px right and right padding and will be as wide as its parent.
textarea,input{ padding:5px 10px 5px 10px; width:100%; }
In this case, the input is wider.
textarea{ box-sizing: border-box; width:100%; padding: 10px }
Ah, the old box model . Filling is ADDED in width, so to achieve the desired effect you will also have to use percentages in the addition. Try the following:
textarea, input { padding: 1% 2% 1% 2%; width: 96%; }
You can check my answer in a related question
Demo on jsFiddle :
HTML markup:
<div class="input_wrap"> <input type="text" /> </div>
CSS
div { padding: 6px 10px; /* equal to negative input margin for mimic normal `div` box-sizing */ } input { width: 100%; /* force to expand to container width */ padding: 5px 10px; border: none; margin: 0 -10px; /* negative margin = border-width + horizontal padding */ }
Add the margin property to the css code.
Source: https://habr.com/ru/post/1447828/More articles:QMenu modess / async - c ++How to remove the imaginary part from numbers such as x + 0.0i in R - rPython module testing - pythonJava structure. Is there a need to insert try statements? - javaPython recursive animation in QuickDraw - pythonEntering data into a dictionary - pythonCall firebug lite methods from javafx 2.2 website - javascriptObject Using the name of the prototype function name instead of its property - javascriptTabs.url - undefined - javascriptF # Email Listener - .netAll Articles