Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /css/css-grid/grid-items/grid-items-em-paddings-001.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="match" href="grid-items-em-paddings-001-ref.html">
<meta name="assert" content="em paddings on stretched grid items in fixed-size tracks resolve against the item's font size.">
<html>
<head>
<style>
.grid {
display: grid;
width: 300px;
height: 300px;
grid-template-columns: 150px 150px;
grid-template-rows: 150px 150px;
font-size: 20px;
background-color: green;
}
/* Verify fixed em padding resolves correctly. */
.topLeft {
grid-row: 1 / 2;
grid-column: 1 / 2;
padding: 0.1em 0.2em 0.3em 0.4em;
background-color: blue;
}
.topRight {
grid-row: 1 / 2;
grid-column: 2 / 3;
padding: 0.5em 0.6em 0.7em 0.8em;
background-color: blue;
}
.bottomLeft {
grid-row: 2 / 3;
grid-column: 1 / 2;
padding: 0.9em 1em 1.1em 1.2em;
background-color: blue;
}
.bottomRight {
grid-row: 2 / 3;
grid-column: 2 / 3;
padding: 1.3em 1.4em 1.5em 1.6em;
background-color: blue;
}
.topLeftContent {
width: 20px;
height: 20px;
background-color: purple;
}
.topRightContent {
width: 20px;
height: 40px;
background-color: purple;
}
.bottomLeftContent {
width: 40px;
height: 20px;
background-color: purple;
}
.bottomRightContent {
width: 40px;
height: 40px;
background-color: purple;
}
</style>
</head>
<body>
<div class="grid">
<div class="topLeft"><div class="topLeftContent"></div></div>
<div class="topRight"><div class="topRightContent"></div></div>
<div class="bottomLeft"><div class="bottomLeftContent"></div></div>
<div class="bottomRight"><div class="bottomRightContent"></div></div>
</div>
</body>
</html>