kacpi2442 kacpi2442 - 2 months ago 29
HTML Question

How to center input of form in table? HTML

I want to put inputs in a one row.
Sorry for my poor english.

<table border='1' cellpadding="25" style='border-collapse: collapse;border-color: silver;'>
<tr style='font-weight: bold;'>
<td width='350' align='center'>
Login: <input type="text" name="login" maxlength="20" size="25" /><br>
Password: <input type="password" name="password" size="25" maxlength="32" /><br>
Repeat password: <input type="password" name="password2" size="25" maxlength="32" /><br><br>


I think you are trying to get all this aligned in the center.For that we have to use the the "tr" tag defines a row in an HTML table and "th" tag which defines a header cell in an HTML table.Try the following code :

<h2 align="center">Register</h2>
    <table align="center">
            <td><input type="text" name="login" align="middle"/></td>
            <td><input type="password" name="pass" align="middle"/></td>
            <td>Repeat Password</td>
            <td><input type="password" name="rpass" align="middle"/></td>


Also we use the align property for table and the new rows we create to get what you desire.