Xecure Xecure - 1 year ago 176
CSS Question

margin-left: auto and margin-right: auto not working on input

I have an input in a form that I am trying to align in the center. Usually

margin-right: auto
fail to respond when
display: block
isn't added to the CSS. I have added
display: block
to my CSS but still it isn't display as I would like it to.

I've made a JSFiddle to keep easier to understand: http://jsfiddle.net/XnKDQ/97/

Answer Source

In order for margin: 0 auto; to work, in addition to display:block a width needs to be specified.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download