HTML and CSS Reference
In-Depth Information
The <form> element defines the form, and all form
input elements are nested inside it.
The “email”, “url”, and “tel” types create single-
line text inputs that cause custom keyboards to
appear on some mobile browsers for easier data
The action attribute contains the URL of the
server script.
A <textarea> element creates a multiline text input
The method attribute contains the method of
sending the form data: either POST or GET.
A <select> element creates a menu, which
contains one or more <option> elements.
<option> elements define the items in the menu.
A POST packages form data and sends it as part
of the request.
A GET packages form data and appends it to the
If you put text into the content of a <textarea>
element, it will become the default text in a text
area control on the web page.
Use POST when the form data should be private,
or when it is large, such as when a <textarea> or
file <input> element is used.
The value attribute in the text <input> element can
be used to give a single-line text input an initial
Use GET for requests that might be bookmarked.
The <input> element can act as many different
input controls on the web page, depending on the
value of its “type” attribute.
Setting the value attribute on a submit button
changes the text of the button.
When a web form is submitted, the form data
values are paired with their corresponding names,
and all names and values are sent to the server.
A type of “text” creates a single-line text input.
A type of “submit” creates a submit button.
CSS table display is often used to lay out forms,
given that forms have a tabular structure. CSS
can also be used to style the form's color, font
styles, borders, and more.
A type of “radio” creates one radio button. All radio
buttons with the same name make up a group of
mutually exclusive buttons.
A type of “checkbox” creates one checkbox
control. You can create a set of choices by giving
multiple checkboxes the same name.
HTML allows form elements to be organized with
the <fieldset> element.
The <label> element can be used to attach labels
to form elements in a way that aids accessibility.
A type of “number” creates a single-line text input
that expects numeric characters only.
Use the placeholder attribute to give the form user
a hint about the kind of content you expect in a
A type of “range” creates a slider control for
numeric input.
A “color” type creates a color picker in browsers
that support this type (and a text input otherwise).
The required attribute indicates a field is required
for the form to be submitted correctly. Some
browsers will force you to enter data into these
fields before submitting the form.
A “date” type creates a date picker in browsers
that support this type (and a text input otherwise).
Search WWH ::

Custom Search