我正在尝试在所有容器宽度上显示表,实际上我正在使用col-sm-2
类和引导程序的hideable-sidebar
。这是我的html结构:
<div class="col-sm-2 hideable-sidebar" id="resource_container">
<h4>Resource</h4>
<div class="input-group">
<input type="text" placeholder="search" class="form-control" >
<span class="input-group-btn">
<button class="clear btn btn-default" type="button">
<span class="glyphicon glyphicon-remove"></span>
</button>
</span>
</div>
<table style="margin-top: 10px; height: 396px;" border='1'>
<tr id="res-1"><td style="background-color:#FF000C" class="resource-color"> </td><td style="padding-left: 10px"><div><strong>foo</strong><br>test</div></td></tr>
<tr id="res-1"><td style="background-color:#F41FF2" class="resource-color"> </td><td style="padding-left: 10px"><div><strong>foo</strong><br>test</div></td></tr>
<tr id="res-1"><td style="background-color:#FFCCC2" class="resource-color"> </td><td style="padding-left: 10px"><div><strong>foo</strong><br>test</div></td></tr>
</table>
</div>
这是我需要采取的最终结果的图像:
答案 0 :(得分:1)
只需将width: 100%;
添加到您的表格,就像我在这里所做的那样:
https://jsfiddle.net/DTcHh/28309/
我希望这是你在寻找的东西:)
答案 1 :(得分:0)
这是完整的代码..
只需复制并通过它..
<div class="col-sm-2 hideable-sidebar" id="resource_container">
<h4>Resource</h4>
<div class="input-group">
<input type="text" placeholder="search" class="form-control" >
<span class="input-group-btn">
<button class="clear btn btn-default" type="button">
<span class="glyphicon glyphicon-remove"></span>
</button>
</span>
</div>
<table border='1' style="margin-top: 10px; height: 396px; width: 100%;">
<tr id="res-1"><td style="background-color:#FFCCC2" class="resource-color"> </td><td style="padding-left: 10px"><div><strong>foo</strong><br>test</div></td></tr>
<tr id="res-1"><td style="background-color:#F41FF2" class="resource-color"> </td><td style="padding-left: 10px"><div><strong>foo</strong><br>test</div></td></tr>
<tr id="res-1"><td style="background-color:#F4CCC2" class="resource-color"> </td><td style="padding-left: 10px"><div><strong>foo</strong><br>test</div></td></tr>
</table>
</div>