Skip to content

Commit 9272328

Browse files
authored
[css-backgrounds-4] Added previews for colors (w3c#8178)
1 parent 2ff1d65 commit 9272328

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

css-backgrounds-4/Overview.bs

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ spec:css-text-4; type:value; text:collapse
2121
spec:css-shapes-2; type:function; text:path()
2222
</pre>
2323

24+
<link rel="stylesheet" href="style.css" />
25+
2426
<h2 id="intro">
2527
Introduction</h2>
2628

@@ -221,7 +223,7 @@ Painting Area: the 'background-clip' property</h3>
221223
<pre class=lang-css>
222224
.foo {
223225
border: 30px solid;
224-
border-color: stripes(dodgerblue, skyblue) stripes(yellow, gold) stripes(lightgreen, limegreen) stripes(indianred, orange);
226+
border-color: stripes(<span class="swatch" tabIndex="0" style="--color: dodgerblue"></span>dodgerblue, <span class="swatch" tabIndex="0" style="--color: skyblue"></span>skyblue) stripes(<span class="swatch" tabIndex="0" style="--color: yellow"></span>yellow, <span class="swatch" tabIndex="0" style="--color: gold"></span>gold) stripes(<span class="swatch" tabIndex="0" style="--color: lightgreen"></span>lightgreen, <span class="swatch" tabIndex="0" style="--color: limegreen"></span>limegreen) stripes(<span class="swatch" tabIndex="0" style="--color: indianred"></span>indianred, <span class="swatch" tabIndex="0" style="--color: orange"></span>orange);
225227
}
226228
</pre>
227229

css-backgrounds-4/style.css

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
.swatch {
2+
position: relative;
3+
z-index: 1;
4+
display: inline-block;
5+
vertical-align: calc(-.1em - 3px);
6+
padding: .6em;
7+
background-color: var(--color);
8+
border: 3px solid white;
9+
border-radius: 3px;
10+
box-shadow: 1px 1px 1px rgba(0,0,0,.15)
11+
}
12+
13+
.swatch:hover,
14+
.swatch:focus {
15+
transform: scale(3);
16+
border-radius: 2px;
17+
transition: .4s;
18+
z-index: 2;
19+
}

0 commit comments

Comments
 (0)