Reputation: 3
Is there anything in HTML like heredoc syntax in PHP? Because in case of a span with long text I have to use br tags each time I want to have a linebreak.
Upvotes: 0
Views: 649
Reputation: 121
The <pre>
tag sounds like what you're looking for. From MDN: Whitespaces inside this element are displayed as typed.
<pre>
Hello
!!!
World
</pre>
becomes
Hello
!!!
World
You can also use the white-space
CSS property to achieve a similar effect on any tag, though it behaves slightly differently.
<span style="white-space:pre;">Hello
!!!
World
</span>
Upvotes: 1
Reputation: 22817
Don't use spans with long text, use paragraphs, or parse your text as if it were Markdown, like here:
Some Line
Some Other Line
will render to:
<p>Some Line</p>
<p>Some Other Line</p>
Upvotes: 2