如果单元格包含字体图标,为什么表格线会消失

时间:2017-06-14 09:08:24

标签: html twitter-bootstrap-3 font-awesome

即使单元格包含字体图标,我也希望有完整的绘制线条。为什么线条会消失,我该如何改变这种行为? 如果有人能给我一个正确方向的提示,那就太好了。

图片:

Example Image

HTML

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>

<div class="container">
  <h2>Hover Rows</h2>
  <p>The .table-hover class enables a hover state on table rows:</p>            
               <table class="table table-hover">
                        <thead>
                            <tr>
                                <th>Firstname</th>
                                <th>Lastname</th>
                                <th>Email</th>
                                <th>Preis</th>
                                <th> </th>
                                <th></th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td>John</td>
                                <td>Doe</td>
                                <td>john@example.com</td>
                                <td> </td>
                                <td><button class="btn btn-secondary"  type="button"> <span class="fa fa-envelope"></span></button></td>
                            </tr>
                            <tr>
                                <td>Mary</td>
                                <td>Moe</td>
                                <td>mary@example.com</td>
                            </tr>
                            <tr>
                                <td>July</td>
                                <td>Dooley</td>
                                <td>july@example.com</td>
                            </tr>
                        </tbody>
                    </table>
</div>

</body>
</html>

2 个答案:

答案 0 :(得分:1)

尝试添加缺少的<td></td>,即使它们是空的

  <!DOCTYPE html>
<html lang="en">
<head>
  <title>Bootstrap Example</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>

<div class="container">
  <h2>Hover Rows</h2>
  <p>The .table-hover class enables a hover state on table rows:</p>            
               <table class="table table-hover">
                        <thead>
                            <tr>
                                <th>Firstname</th>
                                <th>Lastname</th>
                                <th>Email</th>
                                <th>Preis</th>
                                <th> </th>
                                <th></th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td>John</td>
                                <td>Doe</td>
                                <td>john@example.com</td>
                                <td> </td>
                                <td><button class="btn btn-secondary"  type="button"> <span class="fa fa-envelope"></span></button></td>
                            </tr>
                            <tr>
                                <td>Mary</td>
                                <td>Moe</td>
                                 <td> </td>
                                <td>mary@example.com</td>
                                 <td><button class="btn btn-secondary"  type="button"> <span class="fa fa-envelope"></span></button></td>
                            </tr>
                            <tr>
                                <td>July</td>
                                <td>Dooley</td>
                                 <td> </td>
                                <td>july@example.com</td>
                                <td><button class="btn btn-secondary"  type="button"> <span class="fa fa-envelope"></span></button></td>
                            </tr>
                        </tbody>
                    </table>
</div>

</body>
</html>

答案 1 :(得分:0)

你有第二和第三个身体行的缺少/更少的标签。

&#13;
&#13;
 <tbody>
                            <tr>
                                <td>John</td>
                                <td>Doe</td>
                                <td>john@example.com</td>
                                <td> </td>
                                <td><button class="btn btn-secondary"  type="button"> <span class="fa fa-envelope"></span></button></td>
                            </tr>
                            <tr>
                                <td>Mary</td>
                                <td>Moe</td>
                                <td>mary@example.com</td>
                                <td> </td>
                                <td><button class="btn btn-secondary"  type="button"> <span class="fa fa-envelope"></span></button></td>
                            </tr>
                            <tr>
                                <td>July</td>
                                <td>Dooley</td>
                                <td>july@example.com</td>
                                <td> </td>
                                <td><button class="btn btn-secondary"  type="button"> <span class="fa fa-envelope"></span></button></td>
                            </tr>
                        </tbody>
&#13;
&#13;
&#13;