作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想知道如何将两个表格放在彼此的顶部并占据相同的宽度。
这是示例 html:
<div class="wd100 gridcntnr">
<table class="wd100 bgred">
<tbody>
<tr>
<td>LOREM IPSUM</td>
<td>NAME</td>
<td>ABC</td>
</tr>
</tbody>
</table>
<table class="wd100">
<thead>
<tr>
<th>Header 1</th>
<th>Header 2</th>
<th>Header 3</th>
<th>Header 4</th>
<th>Header 5</th>
<th>Header 6</th>
<th>Header 7</th>
<th>Header 8</th>
<th>Header 9</th>
<th>Header 10</th>
<th>Header 1</th>
<th>Header 2</th>
<th>Header 3</th>
<th>Header 4</th>
<th>Header 5</th>
<th>Header 6</th>
<th>Header 7</th>
<th>Header 8</th>
<th>Header 9</th>
<th>Header 10</th>
<th>Header 1</th>
<th>Header 2</th>
<th>Header 3</th>
<th>Header 4</th>
<th>Header 5</th>
<th>Header 6</th>
<th>Header 7</th>
<th>Header 8</th>
<th>Header 9</th>
<th>Header 10</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
对应的css为:
.gridcntnr{
overflow:auto;
border: 1px solid black;
}
.wd100{
width: 100%;
}
.bgred{
background-color:red;
}
我想知道为什么两个表的排列方式不同(额外的空间出现在右侧的顶部表中)以及如何将两个表彼此排列并占用相同的宽度.
我尝试使用 table-layout:fixed;但是这样做会导致第二个表变得不合理,并且右侧顶部表中出现的额外空间并未完全删除。
任何帮助将不胜感激。请贡献。
最佳答案
您是否按照以下文档尝试过绝对定位? -> http://www.htmldog.com/guides/css/intermediate/layout/
关于html - 如何将两张 table 放在彼此的顶部,占用相同的宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20930513/
我是一名优秀的程序员,十分优秀!