I am following the certification of front end development (html and css) . There is a practice project in which we make a form . Now I have a question , see:
my html code is:
<h1>Registration Form</h1> <p>Please fill out this form with the required information</p> <form action='https://register-demo.freecodecamp.org'> <input type="submit" value="Submit" /> </form>
now if I add my css code like
/* display: block; */ width: 60%; margin: 0 auto; height: 2em; font-size: 1.1rem; background-color: #3b3b4f; border-color: white;
my page looks like :
Now see that submit button is not in center i.e it is in left of the form , but as I uncomment above comment it comes in center , I believe that because of statement ‘margin:0 auto’ it should come in center , why by changing its display to block it comes in center i.e center of the form.
(This is not complete Css code actually I have also style form tag in such a way that my form is in center , )
Please explain !