HTML Forms

HTML forms have become an integral part of the web. Forms enable website users to enter and submit data via the website.

Forms are created by using the <form> tag. The <form> element declares the form, but you also need to place form-associated elements inside this element (or reference the form via the form-associated element's form attribute). The elements you use will depend on what you want the form to do.

Basic Form Example

Here's an example of a basic HTML form:

Source CodeResult
Pick a color: Red Green Blue

As you can see, the form includes a bunch of <input> elements to provide some functionality.

Form–Associated Elements

The following elements are form–associated elements. These elements can be associated with a form by being enclosed between its start/end tags, or by using the form attribute. For more information, see the <form> tag.

Form Codes

Here are pages that provide copy/paste codes for various form elements and functions.