Common input
element attributes
The maxlength
and minlength
attributes
The maxlength
attribute is a form control maxlength
attribute.The
minlength
attribute is a form control minlength
attribute.If the
input
element has a maximum allowed value length, then the
code-unit length of the value of the element's value
attribute must be equal to or less than the element's
maximum allowed value length.
The following extract shows how a messaging client's text entry could be arbitrarily
restricted to a fixed number of characters, thus forcing any conversation through this medium to
be terse and discouraging intelligent discourse.
<label>What are you doing? <input name=status maxlength=140></label>
Here, a password is given a minimum length:
<p><label>Username: <input name=u required></label> <p><label>Password: <input name=p required minlength=12></label>
The size
attribute
The size
attribute gives the number of
characters that, in a visual rendering, the user agent is to allow the user to see while editing
the element's value.The
size
attribute, if specified, must have a value that
is a valid non-negative integer greater than zero.e=file multiple name=att></label>
The min
and max
attributes
Some form controls can have explicit constraints applied limiting the allowed range of values
that the user can provide. Normally, such a range would be linear and continuous. A form control
can have a periodic domain, however, in which case the
form control's broadest possible range is finite, and authors can specify explicit ranges within
it that span the boundaries.
Specifically, the broadest range of a
The type=time
control is midnight to midnight (24 hours), and
authors can set both continuous linear ranges (such as 9pm to 11pm) and discontinuous ranges
spanning midnight (such as 11pm to 1am).min
and max
attributes indicate the allowed range of values for
the element.If the element does not have a periodic domain, the
max
attribute's value (the maximum) must not be less than the min
attribute's value (its minimum).An element has range limitations if it has a defined minimum or a defined maximum.
The following date control limits input to dates that are before the 1980s:
<input name=bday type=date max="1979-12-31">
The following number control limits input to whole numbers greater than zero:
<input name=quantity required="" type="number" min="1" value="1">
The following time control limits input to those minutes that occur between 9pm and 6am,
defaulting to midnight:
<input name="sleepStart" type=time min="21:00" max="06:00" step="60" value="00:00">
Name attribute
Definition and Usage
The <a> name attribute is not supported in HTML5. Use the id attribute instead.The name attribute specifies the name of an anchor.
The name attribute is used to create a bookmark inside a document.
The href or the name attribute must be present in the <a> tag.
The name attribute specifies the name of an anchor:
<a name="C4">Chapter 4</a>
No comments:
Post a Comment
its cool