layout: background-origin attribute for gradients

Fixes the glitches mentioned in #19554.
Now gradient tiles are placed in the whole bounding box.
This commit is contained in:
Pyfisch 2017-12-14 23:17:45 +01:00
parent 7897bd15d7
commit b0492f53af
8 changed files with 202 additions and 25 deletions

View file

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
#x {
width: 280px;
height: 280px;
background-image: repeating-linear-gradient(to bottom right, white, black, white 30px);
}
</style>
</head>
<body>
<div id="x"></div>
</body>
</html>

View file

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Gradient Background aligned to Content Box</title>
<link rel="help" href="https://www.w3.org/TR/css-backgrounds-3/#the-background-origin">
<link rel="match" href="gradient-border-box-ref.html">
<meta name="assert" content="The background-origin: border-box; statement is understood.">
<style>
#x {
background-origin: border-box;
width: 200px;
height: 200px;
border-style: solid;
border-width: 40px;
border-color: transparent;
background-image: repeating-linear-gradient(to bottom right, white, black, white 30px);
}
</style>
</head>
<body>
<div id="x"></div>
</body>
</html>

View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
#x {
width: 200px;
height: 200px;
border: 40px;
border-style: solid;
border-color: transparent;
background-image: repeating-linear-gradient(to bottom right, white, black, white 30px);
}
</style>
</head>
<body>
<div id="x"></div>
</body>
</html>

View file

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Gradient Background aligned to Content Box</title>
<link rel="help" href="https://www.w3.org/TR/css-backgrounds-3/#the-background-origin">
<link rel="match" href="gradient-content-box-ref.html">
<meta name="assert" content="The background-origin: content-box; statement is understood.">
<style>
#x {
background-origin: content-box;
width: 200px;
height: 200px;
padding: 40px;
background-image: repeating-linear-gradient(to bottom right, white, black, white 30px);
}
</style>
</head>
<body>
<div id="x"></div>
</body>
</html>