What is the use of wrap in html? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the use of wrap in html?

<div class="wrap"> </div>

9th Jan 2017, 5:07 PM
Saumya Saloni
Saumya Saloni - avatar
5 Answers
+ 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; ... }
9th Jan 2017, 5:47 PM
Kirk Schafer
Kirk Schafer - avatar
+ 3
No worries; been editing to ensure friendly tone.
9th Jan 2017, 5:53 PM
Kirk Schafer
Kirk Schafer - avatar
+ 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; } ...
9th Jan 2017, 5:16 PM
Kirk Schafer
Kirk Schafer - avatar
+ 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>
9th Jan 2017, 5:22 PM
Alex Soh Chye Wat
Alex Soh Chye Wat - avatar
+ 1
@Kirk Thx for correction.
9th Jan 2017, 5:52 PM
Alex Soh Chye Wat
Alex Soh Chye Wat - avatar