Center submit button

How can i center a submit button in a page?

CSS:

.button
{
  width: 150px;
  text-align: center;
  margin:0 auto;

}

HTML

 <input class="button" type="submit" value="Ok" />

I have tried to put the button inside a <p> or <div> tag and it doesn´t work.
The button is always align at left.
My form has 3 floated collumns but i have add clear:both before putting the button.

Put the {text-align: center;} on the block level parent, e.g.

<p id="submission"><input type="submit" value="OK"></p>
================
#submission {
  text-align: center;
  }

cheers,

gary

Hi, if you do want a width/auto margins that only works if you set it to a block element
Adding display:block should fix it. Otherwise you could just add text-algign as recommended by gary.turner.

Thanks. It works.:slight_smile:
I was convinced that i had tried this before.