Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best practice for making web forms

Tags:

html

forms

Is it ok to use tables to make web forms or should I use div's? I know how to use tables, but how should I make form with div's or is it better to use tables?

<form method="post">
    <table>
        <tr>
            <td>
                <label for="username">Username:</label>
            </td>
            <td>
                <input type="text" name="username" id="username"/>
            </td>
        </tr>
        <tr>
            <td>
                <label for="password">Password:</label>
            </td>
            <td>
                <input type="password" name="password" id="password"/>
            </td>
        </tr>
        <tr>
            <td>
                <input type="submit" name="cancel" value="Cancel"/>
            </td>       
            <td>
                <input type="submit" name="send" value="Send"/>
            </td>
        </tr>
    </table>
</form>

Possible Duplicate: Why-not-use-tables-for-layout-in-html

like image 495
newbie Avatar asked Jan 29 '10 19:01

newbie


1 Answers

Don't use tables, that's a very brittle, non-semantic layout, use proper CSS layout. Below are some presentations that explain some good approaches to form layout, including usability considerations. The first link is more about the code, and the second more about design and usability considerations:

  • Learning To Love Forms (Web Directions South '07)
  • Best Practices for Form Design
like image 57
D'Arcy Rittich Avatar answered Oct 13 '22 03:10

D'Arcy Rittich