Can somebody please explain the difference between pre and pre-wrap values of white-space property. | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 2

Can somebody please explain the difference between pre and pre-wrap values of white-space property.

23rd Aug 2018, 3:02 PM
Megha Taunk
11 Réponses
+ 3
rows and cols defines how many lines (rows) and characters (letters, numbers, punctuations and special characters are counted as columns) are visible on the textarea, respectively. In the example, the textarea was told to prepare an area that would fit 7 rows (lines) with each line fits a maximum of 35 characters.
31st Aug 2018, 5:32 PM
Ipang
+ 5
Try to read this tutorial first, then you can ask if you still find difficulties, I'll try to explain it, though I doubt I could do better than the tutorial : ) https://www.w3schools.com/cssref/pr_text_white-space.asp
26th Aug 2018, 9:55 AM
Ipang
+ 2
Please help me with this..I am not getting it through the tutorial.
31st Aug 2018, 1:49 PM
Megha Taunk
+ 2
Alright, I'll try to help a bit, so which part of it is particularly troublesome or hard to comprehend?
31st Aug 2018, 4:17 PM
Ipang
+ 2
Paste this in a blank web code HTML tab, I hope this helps you see the difference : ) <!DOCTYPE html> <html> <head> <title>CSS white-space</title> </head> <body> <p>Text with white-space : <strong>pre</strong></p> <textarea rows="7" cols="35" style="white-space:pre;"> Well, by w3schools' definition, pre ONLY wraps the text on line breaks, but the pre-wrap wraps the text on line breaks and as necessary (as browser sees it). Have you experimented with using this options yet? I guess you might find it clearer with visual testing. </textarea> <p>Text with white-space : <strong>pre-wrap</strong></p> <textarea rows="7" cols="35" style="white-space:pre-wrap;"> Well, by w3schools' definition, pre ONLY wraps the text on line breaks, but the pre-wrap wraps the text on line breaks and as necessary (as browser sees it). Have you experimented with using this options yet? I guess you might find it clearer with visual testing. </textarea> </body> </html>
31st Aug 2018, 4:42 PM
Ipang
+ 2
Alright! glad you got it through, keep it up and happy learning : )
31st Aug 2018, 5:23 PM
Ipang
+ 1
pre and pre-wrap are producing almost same output. I am not getting the difference between the two
31st Aug 2018, 4:19 PM
Megha Taunk
+ 1
Thanks!! Got it finally.
31st Aug 2018, 5:22 PM
Megha Taunk
+ 1
I wanted to know why we included rows and columns in d code
31st Aug 2018, 5:25 PM
Megha Taunk
+ 1
Thankyou
31st Aug 2018, 5:34 PM
Megha Taunk
+ 1
You're welcome! glad if it helps : )
31st Aug 2018, 5:35 PM
Ipang