-2

So im trying to make php echo'ed text stay inside a div. It's probably pretty simple, but I've been fighting with this for some time now.

So in the code below I echo a of a's, and now i want them to stay inside the div of 50px. Tried adding white-space: normal; to the div, but that didnt work out.

In advance, thanks

    <style>
.testDiv {
background-color: yellow;
width: 50px;
height: 100%;
}

</style>

<div class="testDiv">
<?php 

echo "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";

?>

</div>
Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141
  • do you want it to wrap? truncate? or scroll - all doable with css –  Sep 12 '15 at 23:52
  • Yeah, i would like it to be wrapped inside the div. So when the text reaches the end of the div, it just 'breaks' to a new line – Soren Jakobsen Sep 12 '15 at 23:54

1 Answers1

0

Try this:

.testDiv {
    [...]
    word-wrap: break-word;
}