HTML and CSS Reference
In-Depth Information
Even though the textarea element is a container for content, the previous code
would be better formatted using the new placeholder attribute and leaving the con-
tent in the element empty, like so:
<textarea cols="20" rows="5" placeholder="Type your content
Figure 4-23 shows the result.
Figure 4-23. A textarea 20 columns wide and 5 rows high, with placeholder text added
The textarea element includes an attribute not mentioned elsewhere: wrap . This
attribute is used to indicate whether line breaks should be added to the submitted text
area data at the points where the text wraps in the text box's available area. This attrib-
ute can have the value hard or soft . The first, hard , means that newline characters
are added to the submitted form data at the points where the submitted text wrapped
to a new line in the text area. After submitting the form in this state, you will see the
URL-encoded newline character in the URL, which looks like %0D%0A (if using the
GET method). On the other hand, a soft value means that while the text can wrap on-
screen, the submitted data will be sent without any line breaks indicating where the text
wrapped in the text area. This is the default behavior.
A text area control may also use the maxlength attribute to limit the amount of
characters that can be input; this works like how the maxlength attribute works on
a single-line text input control, and the same cautions apply (that is, double-check the
length on the server-side if the data length is of critical importance).
Displaying progress
This is a new element in the HTML5 specification and it is pretty neat! Fundamentally,
it's simple: show how far into a multistage process someone has gotten. For instance, a
form might be spread over multiple pages, and this element is for indicating which page
(out of the total number of pages) the user was on. What is this element called? pro-
gress ! It works like this: there are two attributes, max and value . The max attribute
Search WWH ::

Custom Search