JM at Work
JM at Work

Reputation: 2437

Does position: relative not work with <td>?

Can I say that

position: relative;

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

Upvotes: 1

Views: 986

Answers (2)

Sajitha Rathnayake
Sajitha Rathnayake

Reputation: 1728

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>

Upvotes: 0

Pekka
Pekka

Reputation: 449713

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.

Upvotes: 5

Related Questions