4
What is the usefulness of the attribute wrap
tag textarea
?
What is the difference between your values soft, hard, off
?
4
What is the usefulness of the attribute wrap
tag textarea
?
What is the difference between your values soft, hard, off
?
3
The wrap attribute specifies how the text in the textarea element is to be adjusted when a form is submitted.
Soft: The text in the widget is not adjusted when it is submitted in a form. This is the default value.
Hard: The text in the element is adjusted (containing new lines) when it is submitted in a form. When hard
is used, the attribute cols
must be specified.
EDIT
This makes it a great way to give users an example or description of how to proceed to fill the text area field. Something like, "Please limit your response to 100 characters," would be an ideal description.
References:
2
Just to complement the other answer, as the documentation MDN
Specifies how to break the text in <textarea>
hard: The browser automatically inserts line breaks (CR+LF) at the time the form is submitted so that each line does not exceed the field width limit, the attribute cols
must be specific.
soft: (this is the standard heat if omitted wrap=""
) The browser ensures that all line breaks in value consist of a pair (CR+LF), but does not insert any additional line breaks when the form is submitted.
According to the W3.org are of the values (soft and hard) are new HTML5 features, even if it works in some old browsers, maybe it was not standard.
Note:
- Carriage Return (CR, 0x0D, r) moves the cursor to the beginning of the line without moving to the next line. This character is used as a new line character in Commodore and Early Machintosh operating systems (OS-9 and older).
- Line feed (LF, 0x0A, n) moves the cursor to the next line without returning to the beginning of the line. This character is used as a new line character in UNIX-based systems (Linux, MAC OSX, etc)
Source: http://digital.ni.com/public.nsf/allkb/2856874215F6134A862576C400554081
It is important to mention that it only breaks the value by submitting.
Browser other questions tagged html html5 textarea
You are not signed in. Login or sign up in order to post.
This is the basic documentation, you can tell me if there is any advantage or at what time it is advisable to use one or the other ?
– Gabriel Rodrigues
Good question Gabriel, I’d also like to know.
– Ricardo Afonso
I edited the response on usage and added a new reference.
– Giancarlo Abel Giulian
I don’t understand why you say it’s
o novo atributo para a tag <textarea> no HTML 5
. It is an attribute of the oldest HTML.– Daniel Omine
I translated this information from W3schools
– Giancarlo Abel Giulian
@Danielomine I think it was not standardized, according to all sources I found is Html5, see: https://www.w3.org/TR/html-markup/textarea.html#textarea.attrs.wrap.hard
– Guilherme Nascimento
True! For the textarea element it is an officially new feature. It was possible to use it before in html4 but it was not officially supported.
– Daniel Omine