td { position:relative; } overflows into the table border

后端 未结 4 1269
梦谈多话
梦谈多话 2020-12-10 00:51

http://jsfiddle.net/L83y3/

HTML

stuff more stuff
4条回答
  •  南笙
    南笙 (楼主)
    2020-12-10 01:40

    You can't reliably change the position of a table cell, some browsers (older Safari versions at least, the latest one seems to have fixed this problem) will force table cells (and rows) to position: static no matter what you say.

    If you need to absolutely position something inside a table cell, you'll need to put a relatively positioned

    (or other block element) inside the cell and then put everything else inside that:

    stuff
    more stuff

    And then tweak the CSS:

    .right {
        position:relative;
        width: 100%;
        height: 100%;
    }
    

    And the obligatory live example: http://jsfiddle.net/ambiguous/KUshG/

    I suspect that takes care of the problem you're seeing and does away with some problems that you haven't seen yet.

提交回复
热议问题