I have a problem with my div, when I’m trying to put text inside a div using <?php echo $uin->text; ?>
it doesn’t show up like I want it to.
So if it worked it should have looked like this:
SOME TEXT HERE SOME TEXT SOME LINES BELOW MORE TEXT AT THE BOTOM
but for me it always shows up like this
SOME TEXT HERE SOME TEXT SOME LINES BELOW MORE TEXT AT THE BOTOM
Here is the codes I’ve tried:
<style> .TextAndStuff { background: url(<?php echo $uin->backgroundimg; ?>); background-repeat: no-repeat; width: 100%; text-align: left; } </style> <div class="TextAndStuff"> <?php echo $uin->text; ?> </div>
So I don’t know what I’m doing wrong but if there’s like 3 lines between the top text and the middle text in $uin->text
it doesn’t show those line, everything just gets on the same line.
Advertisement
Answer
Like @u_mulder and @ThrowBackDewd said on the top, use nl2br()
function.
In your case, it would be like this :
<div class="TextAndStuff"> <?php echo nl2br($uin->text); ?> </div>