php - 用户个人资料图像和内容之间的空间。 Bootstrap

标签 php html css forms twitter-bootstrap

我正在使用 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>';
    }
}

最佳答案

我认为差距可能是由于 pull-right 应用于 table

 <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>

关于php - 用户个人资料图像和内容之间的空间。 Bootstrap ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40766434/

相关文章:

php - Preg_match,如果 <code></code> 格式正确

html - 无法让 'align items' 在 Flexbox 中工作

jquery scrollTop 偏移问题

html - 是否可以用透明颜色和文本覆盖 tr?

php - 如何解决并发问题?

php - 将 jQuery 数组字符串转换为 PHP 数组

javascript - 您真的需要指定类型属性吗?

css - 无法获取 Kendo Dropdown 的元素 - Selenium

css - 内联 block 元素在可变宽度容器内均匀分布

php - 验证内容是否已在 Facebook 上共享