开发者

Does position: relative not work with <td>?

开发者 https://www.devze.com 2023-02-27 12:25 出处:网络
Can I say 开发者_运维技巧that position: relative; does not work with <td>? http://jsfiddle.net/nX7T6/

Can I say 开发者_运维技巧that

position: relative;

does not work with <td>? http://jsfiddle.net/nX7T6/


Can I say that position: relative doesn't work with <td>?

I think you can.

The effect of position:relative on table-row-group, table-header-group, table-footer-group, table-row, table-column-group, table-column, table-cell, and table-caption elements is undefined.


Create div tag inside of td and style the dive tag as

posiotion:relative

<style>
td div{
    position: relative;
    border: 1px solid #000;
    width: 10px;
    height: 20px;
}

span.data{
    position:absolute;
    top:2px;
    left:2px;
    background-color#ffffff;
}
</style>

HTML

<table>
    <tr>
        <td>
         <div>
             <span class='data'>Position absolute</span>
         </div>
        <td>

        <td>
         <div>
             Normal
         </div>
        <td>
    </tr>
</table>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号