Form Formatting

Lesson 11

In our last section Using Different Inputs Types,’ we built a basic form it doesn’t look aesthetically pleasing. In this section, we will layout out our form using a table. For more information, see ‘Lesson 7‘.

  1. Change the code that you used in the previous section to this:

<!doctype html>
<title>Lesson 8</title>
<form  name="simpleform" action="lesson 1.html" method="post">
<table width="400" border="1">
<td>Name :</td>
<td><input type="text" name="first name" size="10"></td>
<td>Email id :</td>
<td><input type="text" name="email" size="20"></td>
<td>Password :</td>
<td><input type="password" name="pass" size="20"></td>
<td>Address :</td>
<td><textarea name="address" cols="20" rows="3"> </textarea></td>
<input type="radio" name="gender" value="male">
<input type="radio" name="gender" value="female"></td>
<td><input type="checkbox" name="hobbies" value="cricket">
cricket <br/>
<input type="checkbox" name="hobbies" value="football">
football <br/>
<input type="checkbox" name="hobbies" value="swimming">
<td><input type="submit" value="submit"/></td>

  1. Save your file and from the ‘Run’ menu choose ‘Launch in IE’. You should now see this:

The form is now nicely laid out. We have set a fixed width on the form and a small border using the width=”400″ border=”1″ attributes. You can take this styling further using different fonts and colours.

A formatted form.

Move to the next lesson 'Using advanced styling'

Scroll to Top