html – How to align an input tag to the center without specifying the width?

html – How to align an input tag to the center without specifying the width?

You need to put the text-align:center on the containing div, not on the input itself.

You can use the following CSS for your input field:

.center-block {
  display: block;
  margin-right: auto;
  margin-left: auto;
}

Then,update your input field as following:

<input class=center-block type=button value=Some Button>

html – How to align an input tag to the center without specifying the width?

write this:

#siteInfo{text-align:center}
p, input{display:inline-block}

http://jsfiddle.net/XfSz6/

Leave a Reply

Your email address will not be published.