Solved

How to align a button inside a table cell!

Posted on 2006-10-30
5
727 Views
Last Modified: 2008-02-07
This button will not align to the center of the td cell. It always stays at the to of the cell, which looks bad because the other cells end up below.

I've tried everyting I can think of to center the button inside the table but so far nothing works. If I have to use a style, I'd rather do so on the input line instead of css. But if not, then I'm open to ideas. This must be simple, but not for me.

<table border="1" align="center">
  <tr>
    <td align="center" valign="middle">
   <form name="form1" action="page1.cfm" method="post">
      <div align="center">
         <input type="submit" value="ShowPage1">
      </div>
   </form>
   </td>
   <td>
     Text in table td cell goes here.
   </td>
   <td>
     <img src="image.giv">
   </td>
  </tr>
</table>

 - Georgia
0
Comment
Question by:RollinNow
  • 2
  • 2
5 Comments
 
LVL 30

Accepted Solution

by:
Steggs earned 500 total points
ID: 17838599
Greetings RollinNow,

<table border="1" style="margin:0 auto;height:100px;">
  <tr>
    <td>
<form name="form1" action="page1.cfm" method="post" style="display:inline;">
<input type="submit" value="ShowPage1">
</form>
   </td>
   <td>
     Text in table td cell goes here.
   </td>
   <td>
     <img src="image.giv">
   </td>
  </tr>
</table>

Regards
0
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 17838624
RollinNow,

What do you mean it isn't centered?  Do you mean vertically, horizontally or both?  Is that the same code you used because it appears to center vertically and horizontally in both IE and FF?  Please elaborate on the problem.

Let me know if you have any questions or need more information.

b0lsc0tt
0
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 17838632
I did not see Stegg's comment so hopefully it fixes your problem.  Let us know if it doesn't.
0
 

Author Comment

by:RollinNow
ID: 17838641
You nailed it. Thanks for beautifying lots of websites and tons of pages.

I increased the points to 500.

  - Georgia
0
 
LVL 30

Expert Comment

by:Steggs
ID: 17838647
Your welcome, thanks for the A :)
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Learn by example how to specify CSS selectors for Selenium WebDriver test automation software.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question