[英]Bootstrap fixed table width for wide table
我迷上了我的引導表的設計。 動態生成表格數據,最多包含500列,即序列中每個位置的一列。 首先,我試圖找到一種將列包裝為多行的解決方案,但是我沒有成功,然后決定創建多個表。
最后一張表包含剩余的列,我希望它們具有與前幾列相同的列寬,這在引導程序中似乎很棘手,css樣式的max-width不起作用。 也許您知道解決方案? 謝謝。
下面是一種顯示問題的最小工作示例。
<html lang = "en">
<head>
<title>Table</title>
<meta charset = "utf-8">
<!--<meta name = "viewport" content = "width=device-width, initial-scale=1">-->
<link rel = "stylesheet" href = "http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<style>
.table-bordered thead tr th{
text-align: center;
table-layout: fixed;
width: 10px;
max-width: 10px;
background-color: grey;
}
.table-bordered tbody tr td{
text-align: center;
width: 10px;
max-width: 10px;
}
</style>
</head>
<body>
<div class = "container">
<div class = "row">
<div class = "col-md-12">
<form role = "form" method = "post" action = "">
<?php
$posvector = range(0, 25);
$poschunks = array_chunk($posvector, 10);
foreach ($poschunks as $chunk) {
echo ' <table class="table table-bordered"> ';
echo ' <thead> ';
echo ' <tr> ';
foreach ($chunk as $p) {
echo ' <th> ' . $p . ' </th> ';
}
echo ' </tr> ';
echo ' </thead> ';
echo '<tbody> ';
for ($i = 0; $i < count($chunk); $i++) {
echo ' <td> <input type="radio" name="posradio" value="'
. $i . '"> </td> ';
}
echo ' </tr> ';
echo ' </tbody> ';
echo ' </table> ';
echo ' <br> ';
}
?>
<input id="submit" type="submit" name="submit_pos" value="Submit" class="btn btn-default">
</form>
</div>
</div>
</div>
</body>
</html>
當您使用帶表無表的類時,它應該可以工作。 類表負責覆蓋整個視圖。
echo ' <table class="table-bordered"> ';
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.