Home >Web Front-end >CSS Tutorial >Why Does My Text Area Have Extra Space Below it?
Extra Space Below Textarea: Causes and Solutions
Problem:
Despite using simple markup, extra vertical space appears beneath
Code Snippet:
<code class="html"><html> <head> <style> body { margin: 0; padding: 0; } .main { background-color: red; } textarea { background-color: gray; resize: none; margin: 0; border: 0 none; padding: 10px; height: 50px; overflow: hidden; } </style> </head> <body> <div class="main"> <textarea></textarea> </div> </body> </html></code>
Cause:
The extra space is caused by the default alignment of
Solution:
To eliminate the extra space, add the following CSS rule to your
<code class="css">textarea { vertical-align: top; }</code>
This aligns the
The above is the detailed content of Why Does My Text Area Have Extra Space Below it?. For more information, please follow other related articles on the PHP Chinese website!