<tr>
        <td colspan="2" align="center">
		<input type="button" class="btn" value="New" name="New" onClick="window.location.href='new2.php'" onMouseOver="hov(this,'btn btnhov')" onMouseOut="hov(this,'btn')" align="absmiddle">
          
&nbsp; <input type="submit" value="Delete" name="delete" class="btn" onMouseOver="hov(this,'btn btnhov')" onMouseOut="hov(this,'btn')" ></td>
        </tr>

I am unable to make thses two buttons centred .... any help??

TIA

Recommended Answers

All 4 Replies

You do not say center to what? Your code starts with <tr> so I presume you want to place the two buttons center to a table?

If so, use this:

<CENTER>
<TABLE>

<tr>
        <td colspan="2" align="center">
		<input type="button" class="btn" value="New" name="New" 

onClick="window.location.href='new2.php'" onMouseOver="hov(this,'btn 

btnhov')" onMouseOut="hov(this,'btn')" align="absmiddle">
          
&nbsp; <input type="submit" value="Delete" name="delete" class="btn" 

align="center" onMouseOver="hov(this,'btn btnhov')" 

onMouseOut="hov(this,'btn')" ></td>
        </tr>

</TABLE>
</CENTER>

Using <center> is deprecated since HTML 4.0. You should use CSS to control the styles:

<style type="text/css">
    td.tdcenter
    {
         text-align:center;
         padding: 2px;
    }
</style>

<tr>
        <td class="td_center">
		<input type="button" class="btn" value="New" name="New" onClick="window.location.href='new2.php'" onMouseOver="hov(this,'btn btnhov')" onMouseOut="hov(this,'btn')" align="absmiddle">
 
&nbsp; <input type="submit" value="Delete" name="delete" class="btn" onMouseOver="hov(this,'btn btnhov')" onMouseOut="hov(this,'btn')" ></td>
</tr>

Sorry I was incorrect. text-align won't work because it only applies to in-line content, not a block-level element like a table.

<html>
<head>
</head>
<body>
        <table style="margin:0 auto;">
        <tr>sdkjfs'asfjd'pjdfsa'kjfsdl;kajsf;lkjasd;lfkja</tr>
        <tr>
                <td style="margin:0 auto;">
                        <input type="button" class="btn" value="New" name="New" onClick="window.location.href='new2.php'" onMouseOver="hov(this,'btn btnhov')" onMouseOut="hov(this,'btn')" align="absmiddle">&nbsp;
                        <input type="submit" value="Delete" name="delete" class="btn" onMouseOver="hov(this,'btn btnhov')" onMouseOut="hov(this,'btn')" >
                </td>
        </tr>
        </table>
</body>
</html>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.