When I set the width of an input and a text area to 94% they appear to be slightly different in width. This is something I have seen many times on many sites.
Can anyone explain why a textarea is not as wide as an input when set to the same % width?
input, textarea {
width: 94%;
}
To prevent a text field from being resized, you can use the CSS resize property with its "none" value. After it you can use the height and width properties to define a fixed height and width for your <textarea> element.
<textarea> does not support the value attribute.
Definition and Usage. The <textarea> tag defines a multi-line text input control. The <textarea> element is often used in a form, to collect user inputs like comments or reviews. A text area can hold an unlimited number of characters, and the text renders in a fixed-width font (usually Courier).
With CSS3 you can also use:
-webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
-moz-box-sizing: border-box; /* Firefox, other Gecko */
box-sizing: border-box; /* Opera/IE 8+ */
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With