Closed Bug 268505 Opened 20 years ago Closed 20 years ago

Absolute positioned element inside relative positioned container element is placed wrt. page origin, if the container element is a table, row or cell

Categories

(Core :: Layout: Positioned, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 63895

People

(Reporter: andrew, Unassigned)

References

()

Details

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20040913
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20040913

Ff I place a <div style="position:absolute"> inside a 
<td style="position:relative"> it is positioned at page top left. Similarly
for <tr> or <table>, or all 3, with position:relative. It should be position
with respoect to the table cell (or row, or table) origin.

IE 6 appears to handle this better, though the object is offset by the border
width, and the coloured border from CSS does not appear in the table cell.

I can obtain a workaround by placing the absolute div, span or img inside
a relative div and placing that inside the table cell <td>.


Reproducible: Always
Steps to Reproduce:
<style type="text/css">
div.rbox {
  height:20px; width:40px; top:10px; position:absolute; background-color:red;
}
td.gbox {
  position:relative; width:300px; height:40px;
}
</style>
<table border=1>
<tr><td>Row 1</td><td class="gbox">
<div class="rbox" style="left:60px;">60px</div>
</td></tr></table>

Actual Results:  
The red box appears at (60,10) wrt. the page origin

Expected Results:  
The red box appear at (60,10) wrt. the table cell origin

The test case should look like
http://andrew.triumf.ca/csstest/t12.html

from my reading of CSS on w3.org, an element with CSS position:absolute
is placed relative to the containing element. In Mozilla 1.7/1.8, I can
place a <div style="position:absolute"> inside <div style="position:relative">
and it is visible in the expected position. But not inside a table element

*** This bug has been marked as a duplicate of 63895 ***
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.