-
Notifications
You must be signed in to change notification settings - Fork 711
[css-position][css-tables] position doesn’t apply on <tr> either #1899
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Your HTML is invalid. The parser places the |
Yep. The table elements are associated with a bunch of really terrible parsing rules in HTML. That being said, even with that fixed, Firefox is the only browser that enables position:relative on table rows. I don't have a strong opinion on whether to allow this or not in the spec, but it does seem somewhat useful (except that, well, you cannot have an element in a table row that is not a table-cell, so any element you insert in a table-row will create second column in your table whether it is position:absolute or not, which is not what you want in this case) |
That being said, the table spec currently says:
A table-track is either a table-column or a table-row. |
So a hacky |
I think this was discussed at some point and this was the compromise that had been decided. If it was up to me, the text would say even transform shouldn't work. They do not in Edge, so it's not like this would break the web not to support them on these elements. |
I used a |
In Firefox (at least in Win10), with But with positioning |
|
@fantasai and it seems already to work in Chrome 65 and Firefox 59. By the way, the current behavior of |
@SelenIT The behavior of Firefox looks identical to Chrome's one here. The difference of rendering is due to Gecko's different method for computing the "outline rect" of an element (they union the rect of the element with all the rects of its descendants, including the position:absolute element, while Chrome and Edge use a the border box directly in cases like this). |
Reopening since css-position-3 still needs to be fixed. |
Here's an example page where In this case it is expected that the table cells are displayed the same way as if Reduced example:
Sebastian |
As far as we can tell, the Position 3 text got fixed as part of our rewrite; the clumsier text from the previous draft is gone. Let us know if we're wrong, otherwise I'm closing this since Tables was fixed earlier. |
Just FYI: Chrome 91 will fix posiiton:relative for TR/TBODY. |
Wonderful @atotic ! |
For those who end up here from googling, the workaround using |
In Safari(14.0.1), |
So are there any good solution of how to position |
For what it's worth, a related bug report for Safari/WebKit is https://bugs.webkit.org/show_bug.cgi?id=240961. Sebastian |
The Thanks for the link @SebastianZ |
If your only issue is absolutely positioned elements overflowing the table-row (e.g. absolutely positioned anchors to make a full row clickable), another possible workaround is to use |
my only solution is as usual to disable the row highlight on safari 🤷♂️ |
I worked on this and found it easier to make a 100% different UI for Safari. None of the fixes above worked for me using |
Seems you can create a stacked context in Safari 16.5.1 on these elements via Everything else still doesn't work, but my god it's something. |
From my tests and few hours of research, it seems that
Wrapping the absolute element in a relative one obviously works but then you cannot achieve the goal of the element rendering in context of the row instead of a cell. |
If you apply float on tr, position relative works normally, just need to clean floating for trs |
Float blockifies, so the tr stops being a row and you break the table grid. https://drafts.csswg.org/css2/#dis-pos-flo |
Thanks for your link i know what float does, i propose a solution that work for position problem as like transform solution, i didnt say it was perfect |
In the propdef for position, it is listed:
However, position doesn't seem to apply on
<tr>
either, in every UA I tried (Blink, Gecko, WebKit, Edge). Testcase: http://dabblet.com/gist/4c9499df3f578b75a5a777e058e48adfThe text was updated successfully, but these errors were encountered: