Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Center a ButtonWithin a Table ?

Status
Not open for further replies.

JohnBates

MIS
Feb 27, 2000
1,995
US
Hi HTML people -

I can't get the middle button to position in the center of the form. It appears over to the right, next to the 3rd button.

What have I done wrong?

Thanks, John

<TABLE>
<TR>
<TD width=&quot;100%&quot; align=&quot;LEFT&quot;>
<INPUT TYPE=&quot;SUBMIT&quot; value=&quot;C O N T I N U E&quot;>
</TD>
<TD width=&quot;100%&quot; align=&quot;CENTER&quot;>
<INPUT TYPE=&quot;BUTTON&quot; value=&quot;C A N C E L&quot; name=&quot;Cancel&quot; onclick=&quot;document.location=' </TD>
<TD width=&quot;100%&quot; align=&quot;RIGHT&quot;>
<INPUT TYPE=&quot;RESET&quot; value=&quot;CLEAR FORM&quot;>
</TD>
</TR>
</TABLE>
 
<TABLE width=&quot;100%&quot;>
<TR>
<TD width=&quot;33%&quot; align=&quot;LEFT&quot;>
<INPUT TYPE=&quot;SUBMIT&quot; value=&quot;C O N T I N U E&quot;>
</TD>
<TD width=&quot;33%&quot; align=&quot;CENTER&quot;>
<INPUT TYPE=&quot;BUTTON&quot; value=&quot;C A N C E L&quot; name=&quot;Cancel&quot; onclick=&quot;document.location=' </TD>
<TD width=&quot;33%&quot; align=&quot;RIGHT&quot;>
<INPUT TYPE=&quot;RESET&quot; value=&quot;CLEAR FORM&quot;>
</TD>
</TR>
</TABLE> ***************************************
Party on, dudes!
[cannon]
 
Thanks KarveR,

That worked! I had tried 30% but not 33%.

John
 
...well....

Here at the office, I tried using 33% for each of the buttons and the buttons are not spread across the bottom
of the form like I want. The 3 buttons are on the left half.

On my home PC, using 33% worked perfectly for the same form.

Both PCs run Win 2000 and IE 5.5

Any idea why 1 PC would position the buttons differently ?

Thanks, John
 
... oops. My mistake. I left out the = 100% in my <TABLE
line here at work. Now I have <TABLE = &quot;100%&quot;>
and it works perfectly.
Thanks KarveR !
 
Personally I would always start with defining the table props first before I go to the rows or cells.
<table cellpadding=&quot;&quot; cellspacing=&quot;&quot; summary=&quot;Important to include a summary&quot; border=&quot;&quot; width=&quot;650&quot;>

I prefer fixed units not percentages but obviously its down to you.

After that I would decide how many rows/cells? do you want them all the same size? how do you want them to align their content? etc etc
so my cells will always take this kind of format in my templates:
<td width=&quot;&quot; align=&quot;&quot; valign=&quot;&quot;>

If you organise your table construction it will prevent errors like this from happening.
Start at the outside and work in, works for me.
But this is just my wierd way of doing things and hopefully it may give you some ideas.







I got bloody bored at the weekend:
É,
<!--#include file=&quot;profound quotation&quot; -->
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top