Ideally do not use tables , since the proposal for the table
element is for data tabulation, as if it were the visible form of a database table for example
In the W3C standards documentation on table
says the following:
Tables should not be used purely as a means to layout document content as this may present problems when rendering to non-visual media.
Free Translation:
Tables should not be used purely to structure the content in the layout of a document, as this presents problems when rendered by nonvisual media.
In short, tables may seem like the easiest way to resolve these issues, but in the medium term, specifically when you need to change something is when the headache will come and you will regret bitterly for not choosing the right one. Believe me I've already gone through this.
So the ideal way is to use div
's, better yet, the ideal way is to use a grid system such as Bootstrap for example. Another great advantage of using frameworks such as Bootstrap is that they are designed to be responsive and you can build your form (and the site overall) to be user friendly on devices with larger screens such as desktop's , as well as smaller screens such as tablet's and cell phones.
A responsive functional example of a form (run, click fullscreen and resize the browser window to see the responsiveness in action):
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<form action="cadastro" method="POST">
<div class="container">
<div class="row">
<div class="col-sm-4 col-xs-12">
<div class="form-group">
<label>Primeiro Nome</label>
<input type="text" name="pnome" class="form-control" placeholder="Primeiro Nome">
</div>
</div>
<div class="col-sm-4 col-xs-12">
<div class="form-group">
<label>Último Nome</label>
<input type="text" name="unome" class="form-control" placeholder="Último Nome">
</div>
</div>
<div class="col-sm-4 col-xs-12">
<div class="form-group">
<label>E-mail</label>
<input type="email" name="email" class="form-control" placeholder="E-mail">
</div>
</div>
</div>
<div class="row">
<div class="col-md-4 col-sm-12 col-xs-12">
<div class="form-group">
<label>Endereço</label>
<input type="text" name="endereco" class="form-control" placeholder="Endereço">
</div>
</div>
<div class="col-sm-4 col-xs-12">
<div class="form-group">
<label>Bairro</label>
<input type="text" name="bairro" class="form-control" placeholder="Bairro">
</div>
</div>
<div class="col-md-1 col-sm-4 col-xs-12">
<div class="form-group">
<label>UF</label>
<select name="uf" class="form-control">
<option>Acre</option>
<option>Amazonas</option>
<option>Goiás</option>
<option>Santa Catarina</option>
</select>
</div>
</div>
<div class="col-md-3 col-sm-4 col-xs-12">
<div class="form-group">
<label>Cidade</label>
<select name="cidade" class="form-control">
<option>Porangatu</option>
<option>Manáus</option>
<option>Goiânia</option>
<option>Joinville</option>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12"><button class="btn btn-primary" type="submit">Enviar</button></div>
</div>
</div>
</form>
Here's a list of CSS Frameworks . I'm not sure if everyone has Grid System .
Another very interesting Framework that you do not have in the previous list is Materialize . Particularly I never used it, but visually I found it very attractive.