Mat*_*lko 6 html css html-table
我试图将一个子脚本添加到一个html表格单元格,使它看起来像这样:

(5在细胞中心,99在右下角)
这是一些示例html:
<table class="yearTable">
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td class="dayCell">5
<div class="daySubscript">99</div>
</td>
</tr>
</table>
Run Code Online (Sandbox Code Playgroud)
和我正在使用的CSS:
.yearTable td{
border:1px solid #CCCCCC;
width:45px;
height:45px;
text-align:center;
vertical-align:middle;
}
.dayCell
{
color:Black;
background-color:Aqua;
position: relative;
}
.daySubscript {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
z-index: 10;
text-align:right;
vertical-align:bottom;
}
Run Code Online (Sandbox Code Playgroud)
问题是下标显示在IE8的右上角,并且在Firefox中根本没有显示
IE中的示例输出:

我尝试将单元格中的测试移动到一个单独的div中,我可以覆盖它们但不能抵消它们.
尝试将元素放在右下角,
要看到这项工作:http://jsfiddle.net/bfSVk/
.daySubscript {
/* width: 100%; */
/* height: 100%; */
position: absolute;
bottom:0; /* top: 0; */
right:0; /* left: 0; */
z-index: 10;
text-align:right;
vertical-align:bottom;
}
.yearTable td{
border:1px solid #CCCCCC;
width:45px;
height:45px;
text-align:center;
vertical-align:middle;
position:relative; /* establish relationship with children position absolute */
}
.yearTable {
position:relative;
/* establish relationship with children-children position absolute */
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3309 次 |
| 最近记录: |