twitter-bootstrap 引导表宽度大小和 colspan

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30595190/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 22:45:57  来源:igfitidea点击:

bootstrap table width size and colspan

twitter-bootstrap

提问by user3662974

table width doesn't work when i use colspan. i need colspan. and width size like 100px; or 10% without colspan bottom source code width size works. how do i edit? may i ask? help please.

当我使用 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>

回答by Brendon Vdm

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

I have changed it now, notice that i have taken away the table layout:fixed tag and it worked

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