+ 2
Can somebody please explain the difference between pre and pre-wrap values of white-space property.
11 Antworten
+ 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.
+ 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
+ 2
Please help me with this..I am not getting it through the tutorial.
+ 2
Alright, I'll try to help a bit, so which part of it is particularly troublesome or hard to comprehend?
+ 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>
+ 2
Alright! glad you got it through, keep it up and happy learning : )
+ 1
pre and pre-wrap are producing almost same output. I am not getting the difference between the two
+ 1
Thanks!! Got it finally.
+ 1
I wanted to know why we included rows and columns in d code
+ 1
Thankyou
+ 1
You're welcome! glad if it helps : )