HTML Forms

Menu
Menu

Love your Forms

In the 20/20 section I didn't venture to include any form features. Forms represent the all important 'call to action' for a page. Historically, putting forms together was often a fairly dreary job for a web designer. However, recent enhancements in HTML have made this process more creative and it is a very important part of web design as it is often how your website makes its cash!

View Demos

HTML forms are used to collect user input. The form data is then sent to a server for processing. This tutorial covers the core features of HTML forms.

Basic Form Structure

A form in HTML is created using the <form> element. Here's a simple form example:

Input Types

HTML provides various input types to collect different kinds of data:

Text Input

Password Input

Email Input

Number Input

Date Input

Form Controls

HTML forms include various controls for user input:

Checkboxes

Radio Buttons

Text Area

Form Attributes

Forms have several important attributes:

Grouping Form Data

You can group form elements using the <fieldset> and <legend> elements:

Labels and Accessibility

Using elements enhances accessibility:

The for attribute of the should match the id of the corresponding input element.

Form Validation

HTML5 provides built-in form validation:

Submit and Reset Buttons

Forms usually include a submit button to send data and a reset button to clear it:

Example Form

Here's a complete example of a form with various input types and validation:

More Examples

More examples can be found at:

HTML5 Form Element Demos