Hi.
You would want to start by validating the HTML. There are a few things wrong with that markup that cause it to be displayed incorrectly:
- The DOCTYPE is missing. All HTML and XHTML pages require a doctype, so the browser knows what sort of markup it is supposed to use.
- You are missing the <head> tag, as well as a <title> tag. (You should also include a <meta> tag to set the content-type, but that is not required.)
- "/t text" is not a valid value for the <input type> attribute. You probably meant to use "text".
- Your </br> tags are incorrect. They should be either <br> (HTML) or <br /> (XHTML).
Once you have fixed that, if you want to align the boxes properly, you should try using CSS.
For example, if you change your form to look like this:
- <form action="welcome.php" method="post">
-
<label>Name:</label><input type="text" name="fname"><br>
-
<label>Age:</label><input type="text" name="age"><br>
-
<label>Email:</label><input type="text" name="email"><br>
-
<input type="submit">
-
</form>
-
You could add CSS rules to the <header> section to make the
<label> tags equally wide, thus aligning the input boxes.
- <style type="text/css">
-
label {
-
display: inline-block;
-
width: 75px;
-
text-align: right;
-
}
-
</style>
-