Whitespace | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Whitespace

As we know html ignore whitespace as it also do in <p>, but what if i don't want html to ignore for that <p> For example: I code a <p>Date: - - /--/-- Roll no. - - </p> Output: Date:--/--/-- Roll no. - - But i want the output should be same as i wrote between tag. And also the date and roll no. Should be in same line, how should i bring that space between them?

10th Jul 2018, 12:23 PM
Shyamal Bhatt
Shyamal Bhatt - avatar
3 Answers
+ 4
If you want to convert text with spacing to HTML format, try to use javascript https://code.sololearn.com/WJ2CSqkq3LII/?ref=app
10th Jul 2018, 12:49 PM
Calviղ
Calviղ - avatar
+ 2
You can write a non-breaking space using &nbsp; -- it's a spacebar which isn't removed. <p>Date: --/--/-- &nbsp; &nbsp; &nbsp; Roll no. -- </p>
10th Jul 2018, 12:29 PM
James
James - avatar
+ 1
Another thing you can experiment with is the <pre></pre> tag.
11th Jul 2018, 6:14 AM
Janning⭐
Janning⭐ - avatar