在你的情况....它的发生,因为我觉得你只到div给位置,而不是含<td>
....给这个家长td
位置第一
加的高度,宽度html
,body
和你是好去...
solution
CSS
html, body {
height:100%; /* added */
width:100%;/* added */
}
.divider {
position: relative; /* changed*/
left:30.5%;
top:6%;
bottom:25%;
border-left:2px solid #333;
overflow:hidden;
}
td.r {
position:absolute;/* added */
height:100%;/* added */
width:100%;/* added */
}
HTML
<table width="100%" border=1>
<tr>
<td>this is test</td>
<td class="r"> <!-- notice the added class-->
<div class="divider"></div>
</td>
<td>This is test2</td>
</tr>
</table>
编辑
一个更简单和更清洁的方式来创建分频器使用td
只针对分配,而不是div
.... check this demo
删除创建分隔符的div
,而是将divider
类添加到td
本身!
<table width="100%" border=0>
<tr>
<td>this is test</td>
<td class="divider"></td>
<td>This is test2</td>
</tr>
</table>
CSS
td {
text-align:center
}
td.divider {
position:absolute;
height:100%;
width:1px;
border:1px solid #000;
background:#000;
}
对不起哥哥它没有工作。我已经尝试过了。当我改变分隔器的位置时,它完全消失。 – Bangash
你试过给'位置'包含'td' ...在我的演示中它的工作原理! – NoobEditor
是的,我做到了,但仍然:( – Bangash