如何在不扩展单元格的情况下强制图像在表格单元格中溢出?
编辑:
抱歉,我会提供更多信息。这是表格:
<table class="content">
<col width="200px" />
<col width="560px" />
<col width="200px" />
<tr>
<td colspan="3" class="logo"></td>
</tr>
</table>
CSS:
.logo
{
height: 120px;
background: url('img/wallpaper.png') center;
}
我以为会有一个简单的解决方案...
最佳答案
如果您使用 <img>
标记而不是背景图像,您可以使用 position: absolute;
将其从文档流中删除
html
<td class="logo">
<img src="img/wallpaper.png">
</td>
CSS
.logo img {
position: absolute;
}
这将使图像溢出单元格,但会产生您需要处理的其他副作用。相应地更新顶部或底部以将图像保持在原位。
调整后的 css
.logo img {
position: absolute;
top: 15px;
}
关于html - 强制图像在表格单元格中溢出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15524191/