I have an input in a form that I am trying to align in the center. Usually margin-left:auto
and margin-right: auto
fail to respond when display:
In my case, it was float: left
that I forgot about. So, make sure you apply float: none
to your input field.
You already have display: block
and margin: 0 auto
, you just need to set width too.
Example that should work:
input{
width:50% !important;
margin:0 auto !important;
display:block !important;
float:none !important;
}
If that doesn't work try adding !important
to the values or make sure your style is not overwritten by something else.