Search code examples
htmlcsstextareawhitespace

White space after textarea


I made a contact form with HTML and CSS. But I see some space after textarea element. I replaced it with an input element and the space gone, so it is related to textarea. What is the white space after textarea element and how to remove it?

enter image description here

form {
  width: 100%;
  box-sizing: border-box;
  background-color: white;
  border: solid 2px black;
}
input, textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 20px 20px 20px 70px;
  border-width: 0 0 2px 0;
  border-style: solid;
  border-color: black;
  background-repeat: no-repeat;
  background-size: 40px 40px;
  background-position: 10px center;
  outline: none;
  background-color: #E3FF00;
}
input[type=submit] {
  border-style: none;
}
<form>
 <input type="text" placeholder="Your Name" /><br />
 <input type="email" placeholder="Your EMail Address" /><br />
 <input type="text" placeholder="Your Message Subject" required="required" /><br />
 <textarea rows="5" placeholder="Your Message" required="required"></textarea><br />
 <input type="submit" value="Send" /><br />
</form>


Solution

  • Instead of using <br> after every element in form css use this

    form{    
    display: flex;
    flex-direction: column;
    }
    

    and remove all <br> tags. Your problem will be solved.