Jump to content

Center submit button on my sample form


skyhrg

Recommended Posts

Hi, I have the following codes: HTML

<body>  <div id="main_body"><img name="elvislogo" src="elvislogo.gif" width="229" height="32" border="0" alt="Make Me Elvis"><p>Enter your first name, last name, and email to be added to the <strong>Make Me Elvis</strong> mailing list.</p> <form method="post" action="addemail.php" id="main_form"><div class="table_row"><p><label for="firstname">First name:</label></p><p><input type="text" id="firstname" name="firstname"></p></div> <div class="table_row"><p><label for="lastname">Last name:</label></p><p><input type="text" id="lastname" name="lastname"></p></div> <div class="table_row"><p><label for="email">Email:</label></p><p><input type="text" id="email" name="email"></p></div> <div class="table_row"><p></p><p><input type="submit" name="Submit" value="Submit"></p><p></p></div> </div>   </form>  </body>

CSS

#main_form { display : table;border-spacing : 5px;border : thin dashed grey;background-color : pink; } div.table_row { display : table-row; }  div.table_row p { display : table-cell; }div.table_row p:first-child { text-align : right; } div#main_body { width : 400px;  margin : auto;  padding : 10px; } input, textarea { margin : 5px; }

I want to make the submit button centered, but I don't know how to go about this - I'd make a table row and then place the button, but I don't know how to style the centering. Successfully solved solution would be appreciated. BTW, this code is from a book.

Edited by skyhrg
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...