gpt4 book ai didi

html - 两张 table 紧挨着

转载 作者:行者123 更新时间:2023-11-28 10:41:54 25 4
gpt4 key购买 nike

我希望 #idTable#userTable 并排放置,按钮位于 #idTable 下方。我试过 display: inline-block; 但没有用。此外,我曾尝试将按钮放在 div#userTable 之后,但这会使每次该表填充更多数据时按钮下降更多。我希望按钮保持在左侧。 #userTable 及其信息位于第一个表的右侧。

HTML:

<input type="date" />
<input type="date" />
<br style="clear:both" />
<table border="1" id="idTable">
<tr>
<th><b>#</b>

</th>
<th><b>ID</b>

</th>
</tr>
<tr>
<td>// #'s here</td>
<td>// ID's here</td>
</tr>
</table>
<br style="clear:both" />
<button>Update</button>
<div id="userTable">
<table border="1">
<tr>
<td><b>ID</b>

</td>
<td>Name</td>
</tr>
<tr>
<td colspan="2">
<table border="1" style="width:100%">
<tr>
<td><b>ID</b></td>
<td><b>Name</b></td>
</tr>
</table>
</td>
</tr>
</table>
</div>

CSS:

#idTable{
display:inline-block;
}

#userTable{
display:inline-block;
}

JSFiddle Link

最佳答案

您可以将 #idTable 和按钮放入另一个 div(例如 #wrapper)并设置其 float property左边

HTML:

<div id='wrapper'>
<table border="1" id="idTable">
<tr>
<th><b>#</b>

</th>
<th><b>ID</b>

</th>
</tr>
<tr>
<td>// #'s here</td>
<td>// ID's here</td>
</tr>
</table>
<button>Update</button>
</div>

CSS:

#wrapper {
float: left;
}

参见 http://jsfiddle.net/82zv67d7/7

关于html - 两张 table 紧挨着,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32185008/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com