views:

24

answers:

3

Hi again,

how do I stretch a form submit button using CSS? I'd like to have some kind of horizontal padding between the text inside the button and the button left and right end. Is this possible, and if so, how?

alt text

Tips for making the button prettier (without using images) are also much appreciated :-).

+2  A: 

Increase the width of the button.

<input type="submit" class="btn" />

CSS:

.btn{
  width:250px; /* adjust value */
}
Sarfraz
"text-align: center" too for the original example
mikemerce
Ah thank you, didn't know I could apply classes here :-)
Chris
@Chris: welcome :)
Sarfraz
+1  A: 

You can style it like any other HTML element, for example give it display:block and width:100%.

Radomir Dopieralski
A: 

CSS:

input[type="submit"] {width: 100%;} /* to stretch all submit buttons to full page width, or use width: 300px; as Sarfraz suggested. */

does not work in IE6 cause it does not read type="submit" selector, but works on IE7/8 and all other browsers.

Marco Demajo
Who cares about IE6, anyways?
Michael