FORM
element creates a form.ACTION
, and it must always be a URI.METHOD
set to GET
.NAME
attribute is deprecated; use an ID
instead.FIELDSET
element FIELDSET
used to group related form fields. Can be nested.LEGEND
element must be used to provide a header for a FIELDSET
.P
or DIV
. If you want to provide a sequence of form fields, you can use OL
(numbered list). This will help preserve the order of the elements.INPUT
element is a standard input field.NAME
and ID
. NAME
used for the server part, ID
- for the client. To avoid ID
conflicts, you can use for them the values “form name-field name”.TEXTAREA
- input field with several lines. Required attributes ROWS
and COLS
.LABEL
element provides a text link with an input field. Internal communication involves entering the input field in LABEL
(can be used for the appropriate design). External communication is achieved by assigning the FOR
attribute of LABEL
value equal to the ID
the corresponding input field.INPUT
and BUTTON
elements are applied. Using BUTTON
more flexible and provides more functions.62.5%
resets the font size to 10 pixels for all browsers.LEGEND
display varies greatly from browser to browser. The bottom indent is processed correctly, the fields are often ignored.input.button {cursor:hand;cursor:pointer}
) to indicate a possible action for the buttons.label:after
to type after the field names ( note. IE does not support :after
).INPUT
by default are displayed as system elements for the current OS. BUTTON
fairly well displayed as a block element. With the help of styles and pictures you can achieve any design. BUTTON
can contain, practically, any element: P
, UL
, etc. In IE, when using several buttons, they all send data at the same time. As a result, for correct processing, you need JavaScript for several BUTTON
on the page.SELECT
allows you to select one or more OPTION
. The VALUE
attribute is optional (by default, the content of the OPTION
sent).OPTGROUP
can be used to group OPTION
to SELECT
. Displayed as an indented list. OPTGROUP
cannot be nested.SELECT
width is 4 pixels larger than what you define for this element.SELECT
element, you can use the replacement lists ( Select Replacement ). Inserting background images is also allowed (javascript enabled is required for proper operation).FIELDSET
will be a good solution for organizing a group of FIELDSET
buttons or checkboxes. Use LEGEND
to output a question or statement (as a title to such a group). UL
lists can also be a decent solution. IE6 will require internal hacks.position:relative
) and about 2 pixels for the upper indent ( padding-top:2px
).LEGEND
ignores WIDTH
attribute. To set the correct size, you can use the embedded element SPAN
.GET
, so that the result can be added to bookmarks ( bookmark ).LEGEND
instead of LABEL
.CLASS
attribute to define relationships between form elements.LABEL
can contain more than one input field.DD
can be used to group form elements when one of the input fields is used as a top level selector.LABEL
can be used for checkboxes and radio buttons. With the help of them you can set the desired width.ABBR
element to denote asterisks on required fields. You can use the tooltip through the TITLE
attribute to explain the form fields. ABBR
ignored in IE6.EM
. Using CSS, you can achieve overlap with the text of the tooltip of the input field ( for example: why should this? Also, it is inconvenient to enter data ).STRONG
inside LABEL
. Messages should be in the form of a simple text about the error and how to fix it. They may also contain references to the place where the error occurred ( note: probably, it means, in particular, transferring the focus immediately to the input field that needs to be corrected ).Source: https://habr.com/ru/post/31279/
All Articles