Reputation: 17185
I have text in db which looks like this:
<p>
blah blah
blah
</p>
When I get the text out of db and display it, I am able to get the <p></p>
to make the paragraph space, but the paragraph between the lines of blah does not show up.
When I try to make it work together, I end up with new lines after the natural new line from pressing the enter, and new line from <p>
so I end up with way too much space between paragraphs.
Is there a way to make sure both ways of formatting work together nicely?
Upvotes: 0
Views: 2250
Reputation: 86064
You can apply this css rule
p {
white-space: pre;
}
If you do it this way, then you won't need to do any transformation of the string itself.
Upvotes: 1
Reputation: 4311
I'd say the correct way to go about this is fixing the HTML. This doesn't seem like a PHP issue. You say you want to display space between the first line blah blah
and the second line blah
. I would rewrite it to be:
<p>
blah blah
</p>
<p>
blah
</p>
Upvotes: 2