ladybird/Tests/LibWeb/Layout/input/flex/flex-container-with-definite-width-avoids-float-intrusions.html
Jelle Raaijmakers af8b256832 LibWeb: Avoid floats for BFC/FFC/GFCs with a definite width
Applicable FCs with an indefinite width simply shrink in their available
space as long as floats are intruding, but as soon as we have a definite
width we must push the box down until it it has enough space again.

Fixes #4136.
2025-08-01 14:26:12 +02:00

50 lines
1.2 KiB
HTML

<!DOCTYPE html>
<style>
body {
width: 400px;
}
.a {
background: blue;
float: left;
height: 100px;
width: 100px;
}
.b {
background: green;
float: right;
height: 200px;
width: 50px;
}
.c {
background: red;
display: flex;
height: 100px;
width: 400px;
}
.d {
background: red;
display: flex;
height: 100px;
margin-left: 12.5%;
width: 300px;
}
.e {
background: red;
display: flex;
height: 100px;
margin-left: 50px;
padding-left: 10%;
width: 150px;
}
.f {
background: red;
display: flex;
margin: 0 auto;
height: 100px;
width: 200px;
}
</style><br><div class="a"></div><div class="c">This should clear the blue box.</div>
<hr><div class="a"></div><div class="b"></div><div class="c">This should clear the green box.</div>
<hr><div class="a"></div><div class="b"></div><div class="d">This should clear the blue box and sit flush against the green box.</div>
<hr><div class="a"></div><div class="e">This should sit flush against the blue box, with 40px of padding to the left.</div>
<hr><div class="a"></div><div class="b"></div><div class="f">This should be centered between the blue and green boxes.</div>