我正在使用php和bootstrap构建一个论坛。它工作100%,我唯一的问题是当用户在一个帖子中发帖时,帖子和用户个人资料图片有很大的差距。它看起来像填充问题,但它们之间没有填充。任何建议都很棒
echo '<div class="container form">
<div class="page-header page-heading">
<tr class="text-center">
<th colspan="2"><h2>' . $row['topic_subject'] . '</h2></th>
</tr>
<table class="table forum table-striped table-hover">
<thead>
<tr>
<th class="cell-stat"></th>
</tr>
</thead/>';
//fetch the posts from the database
$posts_sql = "SELECT
posts.post_topic,
posts.post_content,
posts.post_date,
posts.post_by,
users.user_id,
users.user_name
FROM
posts
LEFT JOIN
users
ON
posts.post_by = users.user_id
WHERE
posts.post_topic = " . mysql_real_escape_string($_GET['id']);
$posts_result = mysql_query($posts_sql);
if(!$posts_result)
{
echo '<tr><td>The posts could not be displayed, please try again later.</tr></td></table>';
}
else
{
while($posts_row = mysql_fetch_assoc($posts_result))
{
echo '
<tbody>
<tr>
<td class="text-center">
</td>
<td class="hidden-xs hidden-sm">
<img src="ppp.png"><br>
<i class="fa fa-clock-o">
</i>
<ul class="pull-left user-info">
<li>'
.$posts_row['user_name'].
'</li>'.
'<li>'
. date('d-m-Y H:i', strtotime($posts_row['post_date'])).
'</li>
</td>
<td class="pull-right">'.
'<p>'
.htmlentities(stripslashes($posts_row['post_content'])).
'</p>
</td>
</tr>';
}
}
if(!$_SESSION['signed_in'])
{
echo '<tr><td colspan=2>You must be <a href="signin.php">signed in</a> to reply. You can also <a href="signup.php">sign up</a> for an account.';
}
else
{
//show reply box
echo '<tr><td colspan="2"><h2>Reply:</h2><br />
<form method="post" action="reply.php?id=' . $row['topic_id'] . '">
<textarea name="reply-content"></textarea><br /><br />
<input type="submit" value="Submit reply" />
</form></td></tr>';
}
//finish the table
echo '</thead></table>';
}
}
答案 0 :(得分:0)
我认为差距可能是pull-right
应用于表
<td class="pull-right">'.
'<p>'
.htmlentities(stripslashes($posts_row['post_content'])).
'</p>
</td>
您可能想要完全删除它。如果没有,请尝试将pull-left
应用于段落而不是表格
<td >'.
'<p class="pull-left">'
.htmlentities(stripslashes($posts_row['post_content'])).
'</p>
</td>