【发布时间】:2017-08-31 13:18:55
【问题描述】:
我的目标是将两张桌子并排放置。我遵循了以下指南:https://stackoverflow.com/a/11690480/2402577
<table style="float: left;">
我的示例代码:
<div class="container" id="coverpage">
<div class="row">
<table id="tableblock" class="display" width="100%" style="float:left"><caption><h3>Latest Blocks</h3></table>
<table id="tabletxs" class="display" width="100%" style="float:left"><caption><h3>Latest Transactions</h3></table>
</div>
</div>
如您所见,这些表格不是并排放置的。我不确定我做错了什么。我该如何解决这个问题?
有了宝贵的建议,它似乎工作了,但现在桌子的高度很小。已完成更改:添加了<div class="col-md-10">,删除了width:这可行,但现在桌子高度不对称且足够长。
<div class="container" id="coverpage">
<div class="row">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<table id="tableblock" class="display"><caption><h3 style="color:black;">Latest Blocks</h3></caption></table>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<table id="tabletxs" class="display"><caption><h3 style="color:black;">Latest Transactions</h3></caption></table>
</div>
</div>
</div>
表格输出:
感谢您宝贵的时间和帮助。
【问题讨论】:
-
由于您使用的是
class属性,请编辑您的问题并添加您的CSS代码。 -
我看到你正在使用
container和row。这是否意味着您正在使用 Bootstrap?因为这会让一切变得更容易。 -
旁注:
h3不允许在caption内。 -
是的,我正在使用 Bootstrap @HubertGrzeskowiak
-
在使用 Bootstrap 时,只需使用正确的
col-md-6或其他。并摆脱 `width="100%"
标签: html html-table