删除css位置的空间:relative

TMB*_*TMB 5 css position css-position

我有一个链接和一个iframe并排.我希望链接显示在iframe上.这发生在td元素内部.这种模式迭代了几行.当我使用相对css定位时,我能够在iframe上显示链接,但链接所在的空间仍然会出现.并且它不必要地增加了列高度.我想消除这个空间.我怎样才能做到这一点?

我看着这个,但似乎这个解决方案仍然会提升tr/td高度.我也有一个问题的样本

kzh*_*kzh 4

折叠行高应该可以做到。确保输入一个测量值,而不仅仅是“0”,这样它才能在 ie6 中工作。我将.collapse类添加到div包含锚点的 s 中。http://jsfiddle.net/grs53/20/

超文本标记语言

<table>
    <tbody>
        <tr>
            <td class="donotwant">
                <div class="collapse">
                    <a class="top" href="bing.com">link</a>
                </div>
                <div>
                    <iframe class="bottom" src="http://www.google.com" ></iframe>
                </div>
            </td>
        </tr>
        <tr>
            <td class="donotwant">
                <div class="collapse">
                    <a class="top" href="bing.com">link</a>
                </div>
                <div>
                    <iframe class="bottom" src="http://www.wikipedia.com" ></iframe>
                </div>
            </td>
        </tr>
    </tbody>
</table>
Run Code Online (Sandbox Code Playgroud)

CSS

.donotwant {
    border:2px dotted green;
}
.top {
    top:80px;
    left:120px;
    position:relative;
    z-index:2;
    background:red;
}
.bottom {
    position:relative;
    z-index:1
}
.collapse {
    line-height:0px;
}
Run Code Online (Sandbox Code Playgroud)