Secret white space at the bottom of a form element

When a form is placed inside a div, for some reason there is always extra space at the bottom of the form. How do we get rid of this space?

In the code snippets from it does not actually show a space, but somewhere else. The code below is all there is.

div { border: 1px solid blue; } form { border: 1px solid red; } 
 <div> <form> Form </form> </div> 
+5
source share
2 answers

You can turn to the web developer tools (F12) and you will see that the form element comes with margin-bottom: 1em , as defined in the default stylesheet :

enter image description here

You can override this by specifying your own field rule:

 form { margin-bottom: 0; } 
+4
source

You have margin-bottom: 16px . Remove it and it will solve your problem.

0
source

Source: https://habr.com/ru/post/1258433/


All Articles