Text overflowing out of a div in a straight line
I have a "body" column in my SQL database which is set to 'text' and from here I have unformatted text stored, when I echo this out in a variable in my while loop inside of index.php instead of staying inside of the div it is placed in, it overflows the div, Can someone help me?
This is my while loop code, the CSS is included into the echoed HTML tag.
while($row = mysql_fetch_assoc($query))
{
$id = $row['id'];
$date = $row['date'];
$body = $row['body'];
$pos开发者_如何学JAVAtdate = date( 'd-m-Y', strtotime($date));
echo "Posted on: $postdate";
if(isset($_COOKIE['userlogin']))
{
echo " <a href='edit.php?id=$id' style='float: right;'>Edit News</a> <a style='float: right;'>[ | ]</a> <a href='delete.php?id=$id' style='float: right;'>Delete News</a>";
}
From here is where I am getting the problem:
echo "<br />";
echo "<div style='width=800px; border: 1px solid #FFF;'>$body</div>";
echo "<hr width='100%' />";
}
It seems that even with the overflow value in place, and the width. That the text still extrudes from it's div tag.
well for most browsers you need to specify a width for the div or it will overflow...also set overflow to auto:
<div style="width:xpx;overflow:auto>echo text</div>
do i understand you correctly?
精彩评论