<p>This is a paragraph</p>
becomes
This is a paragraph
but I want it to remain as is. Like
This is a paragraph
How do I do it?
If you don't want to use
, you can use something like
<p class="allspace">This is a paragraph</p>
.allspace { white-space: pre }
white-space:pre
will format the html with spaces. This approach is better as it doesn't require multiple use of
Use
- it is a non-breakable space.
For example:
<p>This is a paragraph</p>
A non-breaking space (also called no-break space, non-breakable space (NBSP), hard space, or fixed space) is a space character that prevents an automatic line break at its position. In some formats, including
HTML
, it also prevents consecutive whitespace characters from collapsing into a single space.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With