Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to align button centered below table?

I put form elements in a table so that column names and inputs are aligned to 2-columns. And I put submit button and cancel button below the table. The table width is not fixed. I want to put the buttons center-aligned of the table width.

One simple way is to put the buttons in the table. But I want to separate them from the table. What's the most elegant way to do that?

like image 716
Sam Kong Avatar asked Jun 24 '09 07:06

Sam Kong


2 Answers

Structure like this:

<div>
<!-- Your table -->
<table />
<!-- Your buttons -->
<div style="text-align:center;">
<input />
</div>
</div>
like image 131
Dimi Takis Avatar answered Sep 17 '22 16:09

Dimi Takis


Since the buttons and table are related you could use a fieldset:

<fieldset>
<!-- Your table -->
<table />
<!-- Your buttons -->
<p style="text-align:center;">
<input />
</p>
</fieldset>
like image 44
Steve Avatar answered Sep 18 '22 16:09

Steve