Jump to content

Centering Buttons in a Form


DVigneault

Recommended Posts

Hey all--more trouble styling my forms.

 

Here's the HTML:

<div id="wrapper">
<form>
<fieldset>Some stuff</fieldset>
<div id="buttons">
<button>Submit</button>
<button>Reset</button>
</div>
</form>
</div>

 

And the CSS:

div#wrapper {
width: 800px;
margin-left: auto;
margin-right: auto;
}

#buttons {
display: inline;
margin-left: auto;
margin-right: auto;
}

 

I'd like for the "buttons" div to be centered within the 800px "parent" div, but instead it stays against the left side.  I can get it to look roughly how I want by setting margin-left to 300px or so, but I'd really just like it centered (and to know why setting the margins to auto isn't having the effect I thought it'd have).  Any ideas about what I'm doing wrong?

 

Best,

 

-d

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.