我已经看过这个问题并且用Google搜索了一下,但到目前为止还没有任何效果.我现在认为它是2010年(那些问题/答案很老,而且很好,没有答案)我们有CSS3!有没有办法让一个div使用CSS填充整个表格单元格的宽度和高度?
我不知道单元格的宽度和/或高度是提前的,并且将div的宽度和高度设置为100%不起作用.
另外,我需要div的原因是因为我需要绝对将一些元素放在单元格之外,并且position: relative不适用于tds,所以我需要一个包装div.
我有一个表格单元格,我希望其中的div始终位于左下角.以下工作在IE和Safari罚款,但Firefox是定位div绝对的页面上,而不是电池(基于解决方案的解决方案代码中的位置).我已经使用和不使用DTD进行了测试,这使得Firefox处于Quirks模式和标准模式,并且都没有正常工作.我被困 - 任何想法?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Test</title>
<style type="text/css">
table { width:500px; }
th, td { vertical-align: top; border:1px solid black; position:relative; }
th { width:100px; }
.manage { text-align:right; position:absolute; bottom:0; right:0; }
</style>
</head>
<body >
<table>
<tr>
<th>Some info about the following thing and this is actually going to span a few lines</th>
<td><p>A short blurb</p><div class="manage">Edit | Delete</div></td>
</tr>
<tr>
<th>Some info …Run Code Online (Sandbox Code Playgroud)