1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:17:45 +00:00

LibWeb: Add basic support for CSS percentages

Many properties can now have percentage values that get resolved in
layout. The reference value (what is this a percentage *of*?) differs
per property, so I've added a helper where you provide a reference
value as an added parameter to the existing length_or_fallback().
This commit is contained in:
Andreas Kling 2020-05-11 23:04:59 +02:00
parent 8ffdcce0d0
commit 5f9d80d8bc
7 changed files with 117 additions and 31 deletions

View file

@ -0,0 +1,41 @@
<!DOCTYPE html>
<html>
<head>
<style>
#hcontainer {
background-color: black;
}
.hbar {
background-color: blue;
color: white;
}
.w25 { width: 25% }
.w50 { width: 50% }
.w75 { width: 75% }
.w100 { width: 100% }
#vcontainer {
background-color: black;
height: 200px;
}
.vbar {
background-color: blue;
color: white;
}
.h25 { height: 25% }
</style>
</head>
<body>
<div id="hcontainer">
<div class="hbar w25">25%</div>
<div class="hbar w50">50%</div>
<div class="hbar w75">75%</div>
<div class="hbar w100">100%</div>
</div>
<br>
<div id="vcontainer">
<div class="vbar h25">25%</div>
</div>
</body>
</html>

View file

@ -28,6 +28,7 @@ span#ua {
<p>Your user agent is: <b><span id="ua"></span></b></p>
<p>Some small test pages:</p>
<ul>
<li><a href="percent-css.html">CSS percentage values</a></li>
<li><a href="inline-block.html">display: inline-block; test</a></li>
<li><a href="canvas-path-quadratic-curve.html">canvas path quadratic curve test</a></li>
<li><a href="pngsuite_siz_png.html">pngsuite odd sizes test</a></li>