antonpug antonpug - 1 year ago 41
CSS Question

CSS to align a submit button?

I have a submit button on a form tag is input, obviously. Text-align obviously does not work. I don't want to use margin-left because my width might change later on and I want it to be more "proper". Any way you can think of?

HTML:

<input type="submit" value="Subscribe" name="jetpack_subscriptions_widget">


CSS:

#blog_subscription-3 input[name="jetpack_subscriptions_widget"] {
margin-left:25px;
}

Answer Source

Just set the "top", "left", "bottom" or "right" elements. Now the html element that the button is inside of will need to be sized to allow moving it around. For example if the button is in side a of a "span" tag the "span" tag will only be the size of the button (plus any other content in the span). As long as there is space to move it in the parent element one of those four should do the trick.

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