I think that you apply styles that contradict yourself in the box, so you end up with unpredictable behavior. From what I can say, you call this by specifying display: table; on <ul> :
The "position: relative" effect in table-row-group, table-header-group, table-footer-group, table-row, table-column-group, table-column, table-cell and table-caption is undefined. ( http://www.w3.org/TR/CSS21/visuren.html#propdef-position )
There is a table that tries to determine the recommended user agent behavior, http://www.w3.org/TR/CSS21/visuren.html#dis-pos-flo , but I could not fully work out which is applicable for your example.
If I remove the table rules from your CSS, the absolute-position element seems to be correctly positioned in relation to the <li> that wraps it.
EDIT:
The simplest solution I came across is to wrap the contents of each <li> with a <div> , to which you then apply the position: relative; rule position: relative; (** stands for additions): http://jsfiddle.net/TThUZ/4/
<div class="main"> <ul> <li> **<div class="test">** <a> Text </a> <div class="sub"> Sub </div> **</div>** </li> </ul> </div>
and
ul { display: table; } li { display: table-cell; width: 300px; background: #ddd; padding-left: 50px; } **.test { position: relative; }** .sub { position: absolute; left: 0; }
I am sure that you can remove the positioning rule from <li> , since it does not work when elements are displayed as table cells.
source share