ladybird/Tests/LibWeb/Layout/input/block-and-inline/float-clear-simultaneously.html
Jelle Raaijmakers f340f8682b LibWeb: Do not clear float sides for floating boxes with clear: ..
We used to always clear the side data after encountering a box with
`clear: ..`, but this is not the right thing to do if that same box also
has `float: ..` set. For example, with `clear: right` and `float: left`
it might be that the next box still wants to clear the right side, and
since the previous box is floating it did not push the next box down far
enough to justify clearing the side data at that point.

This changes the logic to only clear the float side if the clearing box
itself is not floating. We also no longer clear the opposite side after
placing a floating box; that doesn't seem to be necessary anymore.

Fixes #4102.
2025-03-27 00:56:56 +00:00

26 lines
450 B
HTML

<!DOCTYPE html>
<style>
.a {
background-color: red;
height: 50px;
}
.b {
background-color: green;
height: 50px;
width: 50px;
float: right;
}
.c {
clear: both;
float: left;
}
.d {
background-color: blue;
clear: right;
height: 50px;
}
</style>
<div class="a"></div>
<div class="b"></div>
<div class="c"></div>
<div class="d"></div>