0
What is the use of wrap in html?
<div class="wrap"> </div>
5 Antworten
+ 3
Edit: SKIP: Note corsair's example selectED an #id (1 element) and not a .class (multiple elements).
A complication for 'textarea' is...it's a form element (historically CSS hasn't been able to reliably control form elements) and 'wrap' is an HTML5 attribute; I haven't seen how to set this attribute in CSS yet, though I've been looking. The rest of Corsair Alex's answer covers text wrapping (that works).
Note div's also often 'wrap' other elements for layout purposes:
<div class="wrap">
<div class="left">Avatar, count, date</div>
<div class="right">Text of post / more divs with signature, etc.</div>
</div>
div .wrap {
border: 1px solid black;
...
}
.left {
float: left;
clear:left;
...
}
.right {
float: right;
...
}
+ 3
No worries; been editing to ensure friendly tone.
+ 2
That...doesn't feel like the right question. Classes are defined in CSS; the name is arbitrary. You may as well ask:
<div class="pinkelephant">
</div>
If you don't show the:
<style>
.pinkelephant {
what: it-does;
}
...
+ 2
First of all the wrap class as shown in your example is a class which is used for styling in html. Most likely , you would do this in your css file when defining the class "wrap":
CSS:
.wrap
{
width: 200px;
word-wrap: break-word;
}
Basically , what this does is that you are wanting the text contained in your div to wrap to the next line if the length of the text exceeds 200px.
Other than that, "wrap" also exists in some HTML tags as attributes.
Eg.
<textarea rows="2" cols="20" wrap="hard">
At SoloLearn, you will find free HTML tutorials.
</textarea>
+ 1
@Kirk Thx for correction.