当我使用 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>
最佳答案
<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>
我现在已经更改了它,请注意我已经删除了 table layout:fixed 标签并且它起作用了
关于twitter-bootstrap - Bootstrap 表宽度大小和 colspan,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30595190/