mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 09:45:06 +02:00
For grid items with auto preferred size, stretch/normal alignment, and no auto margins, the final size is simply the containing block size minus margin box sizes. We can compute this directly without calling `calculate_fit_content_width/height`, which triggers expensive intrinsic sizing layout passes.
23 lines
438 B
HTML
23 lines
438 B
HTML
<!DOCTYPE html>
|
|
<style>
|
|
* {
|
|
border: 1px solid black;
|
|
}
|
|
.grid {
|
|
display: grid;
|
|
grid-template-columns: 1fr 1fr;
|
|
grid-template-rows: 1fr 1fr;
|
|
width: 200px;
|
|
height: 200px;
|
|
}
|
|
.item {
|
|
background: lightblue;
|
|
}
|
|
</style>
|
|
<div class="grid">
|
|
<div class="item">1</div>
|
|
<div class="item">2</div>
|
|
<div class="item">3</div>
|
|
<div class="item">4</div>
|
|
</div>
|