我试图让一个div漂浮在一张桌子上,所以它将在所有文本之上?
解决方法
查看
absolute positioning,也可能是
z-index(虽然这是您唯一的绝对定位内容,但您不需要它).虽然还有其他方法可以让事情重叠,但这可能与您最相关.
很简单的例子:
CSS:
#target { position: absolute; left: 50px; top: 100px; border: 2px solid black; background-color: #ddd; }
HTML:
<p>Something before the table</p> <div id="target">I'm on top of the table</div> <table> <tbody> <tr> <td>Text in the table</td> <td>Text in the table</td> </tr> <tr> <td>Text in the table</td> <td>Text in the table</td> </tr> <tr> <td>Text in the table</td> <td>Text in the table</td> </tr> <tr> <td>Text in the table</td> <td>Text in the table</td> </tr> </tbody> </table>
原文地址:https://www.jb51.cc/html/226602.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。