-1
我在我的博客項目中有一個問題,我有一個textarea,用戶可以鍵入和im傳遞給我的mysql表,問題是文本溢出在我的<li>
我試過wordwrap(),但仍然其他文本不斷溢出我不怎麼「格式化」,以便自動將其格式以適合我的div或我的做法是錯誤的oO?,imma新手在PHP顯然:P。 。文本從textarea保存到MySQL到PHP溢出裏面div
感謝...
<?php
session_start();
function __autoload($className)
{
require $className . '.php';
}
$emptyMsg ='';
$conn=new connection();
$conn->conn('localhost','****','');
if(!isset($_SESSION['username']))
{
die('Log In 1st!<a href="loginpage.php">Log In</a>');
}
$query = "SELECT blog_content FROM tbl_blog";
$queryResult=mysql_query($query) or die();
?>
<html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style type="text/css">
p
{
}
#nav
{
}
ul li
{
list-style:none;
}
#blog_wrap
{
clear:both;
width:800px;
height:600px;
margin:0 auto;
background-color:blue;
}
.content
{
width:700px;
clear:both;
float:left;
height:auto;
background-color:gray;
color:lightgreen;
text-align:left;
margin:10px 0 0 50px;
}
.content ul li
{
color:red;
background-color:green;
overflow:visible;
}
.content2
{
width:700px;
clear:both;
float:left;
height:auto;
background-color:yellow;
color:lightgreen;
margin:10px 0 0 50px;
}
</style>
</head>
<body>
<div id="nav" >
<ul >
<li>Welcome!!!<?php echo $_SESSION['username']; ?></li>
<li><a href="">Edit Account</a></li>
<li><a href="createBlog.php">Create Blog</a></li>
<li>Home</li>
<li>Sign Out</li>
</ul>
</div>
<div id="blog_wrap">
<?php
$count=0;
while($rows=mysql_fetch_array($queryResult))
{
if($count % 2 ==0)
{
echo '<div class="content">';
echo '<ul>';
echo '<li>' . $rows['blog_content'] . '</li>';
echo '</ul>';
echo '</div>';
}
else
{
echo '<div class="content2">';
echo '<ul>';
echo '<li>' . $rows['blog_content'] . '</li>';
echo '</ul>';
echo '</div>';
}
$count++;
}
?>
</div>
</body>
</html>
另請注意,overflow:hidden會在發生溢出時阻止滾動條。 –
溢出時會發生什麼:hidden is it cut the text it does not go to a new line the other text beyond the my li dissapears – Aldin