Why does the margin: auto
not center the button inside an li
in this example? I can however use text-align: center
to center it. Why does this happen?
I even tried to insert the button inside a container but this still seems to not work.
ul {
list-style: none;
}
textarea {
vertical-align: middle;
}
.button {
background: blue;
border: solid thin;
display: block;
padding: auto;
}
button {
margin: 0 auto;
width: 100px;
}
<form action="">
<ul>
<li>
<label for="msg">Message:</label>
<textarea name="user_message" id="msg" cols="30" rows="10"></textarea>
</li>
<li class="button">
<button type="button">Button</button>
</li>
</ul>
</form>