引导表宽度大小和colspan

时间:2015-06-02 11:45:43

标签: twitter-bootstrap

当我使用colspan时,表格宽度不起作用。 我需要colspan。和宽度大小像100px;或10% 没有colspan底部源代码宽度大小的工作原理。 我该怎么编辑?我可以问吗? 求助。

<link href="css/bootstrap.min.css" rel="stylesheet">
<style>
  table {
table-layout: fixed;
word-wrap: break-word;
width: 30%;
 }
</style>
</head>
<body>
<table>
  <tr>
      <td colspan="2">abc</td>
 </tr>
  <tr class="table table-bordered">
      <td style="width: 10%;" /td>1</td>
      <td style="width: 20%;" /td>2</td>
  </tr>
</table>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script     src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
 </body>
</html>

1 个答案:

答案 0 :(得分:4)

<html>
<head>
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <style>
      table {
            width: 100%;
            border:1px solid;
     }

     td{
        border:1px solid;
     }
    </style>
    </head>
<body>
<table>
  <tr>
      <td colspan="2">abc</td>
 </tr>
  <tr >
      <td style="width: 40%;">1</td>
      <td style="width: 60%;">2</td>
  </tr>
</table>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script     src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
 </body>
</html>

我现在已经改变了,注意我已经取消了表格布局:固定标签并且它起作用了