how can I adjust if the text reaches the ceiling or at least a certain number of characters go to the next line?
I mean I have a div
but my text(I get it from mysql) is a little longer than my page and a scrollbar will show but I want the text to go to the next line
I tested this code :
<div >
<?php
$strec = $row["text"];
if (strlen($row["text"]) >= 980) {
$strec = str_replace(" ", "\n", $row["text"]);
}
?>
<p><?=$strec?></p>
</div>
But it didn't work
CodePudding user response:
look for something like white-space: nowrap
in your css and if you find it, remove it (maybe it is in your div)
CodePudding user response:
You could do this with character units (ch) in CSS!
try this out
p {
max-width: 10ch
}
<p>i am way bigger than 10 characters long dont you think?</p>