NEW 242313
margin-bottom wraps into next column if columns are of uneven height
https://bugs.webkit.org/show_bug.cgi?id=242313
Summary margin-bottom wraps into next column if columns are of uneven height
Kimberly Grey
Reported 2022-07-04 06:09:07 PDT
Created attachment 460652 [details] HTML example (duplicate of Codepen) ## Steps to reproduce 1. Open the Codepen at https://codepen.io/querkmachine/pen/ExEVVBL or the attached HTML file in Safari. 2. Ensure the viewport is wide enough for the content to be presented in two columns without text wrapping. ## Expected behaviour List items 1 to 7 appear in the first column, list items 8 to 13 appear in the second column. The tops of both columns are vertically aligned with one another. ## Actual behaviour List items 1 to 7 appear in the first column, list items 8 to 13 appear in the second column. The top of the second column appears 20 pixels below the top of the first column, as the `margin-bottom` from list item 7 is being rendered above list item 8. In this example, the issue is triggered by a combination of an odd number of list items and the last list item having the bottom margin reset to 0, creating a large enough difference in column lengths for the margin to wrap. I could also reproduce this in the Safari 16 beta. The columns appear as expected in Firefox and Chromium browsers. ## Potentially related bugs - https://bugs.webkit.org/show_bug.cgi?id=17887 - https://bugs.webkit.org/show_bug.cgi?id=105411 - https://bugs.webkit.org/show_bug.cgi?id=212505
Attachments
HTML example (duplicate of Codepen) (830 bytes, text/html)
2022-07-04 06:09 PDT, Kimberly Grey
no flags
Screenshot of issue in Safari 15.5 (45.89 KB, image/png)
2022-07-04 06:10 PDT, Kimberly Grey
no flags
Test reduction (278 bytes, text/html)
2022-07-12 07:39 PDT, zalan
no flags
Kimberly Grey
Comment 1 2022-07-04 06:10:53 PDT
Created attachment 460653 [details] Screenshot of issue in Safari 15.5
Radar WebKit Bug Importer
Comment 2 2022-07-11 01:56:34 PDT
Karl Dubost
Comment 3 2022-07-11 23:47:20 PDT
Usually adding an outline on elements has no influence on the layout as they do not participate to the computation of width and so on. But I forked the codepen of Kimberley and added outline for the list items. and surprise, "it made it work" https://codepen.io/webcompat/pen/rNdMBvK As a note, do not use the technique to align the items, because this would have consequences for accessibility.
zalan
Comment 4 2022-07-12 07:39:55 PDT
Created attachment 460810 [details] Test reduction It looks like our multicol code gets confused when collapsing margins across columns.
Ahmad Saleem
Comment 5 2023-05-11 13:07:43 PDT
(In reply to zalan from comment #4) > Created attachment 460810 [details] > Test reduction > > It looks like our multicol code gets confused when collapsing margins across > columns. Something similar to this? https://chromium.googlesource.com/chromium/src.git/+/506506eac78a8106c4e92866a59b8c724ddc8b88
Derk-Jan Hartman
Comment 6 2024-10-31 13:47:08 PDT
Isn't this another case of 104944 ?
Note You need to log in before you can comment on or make changes to this bug.