Skip to content

Commit 6949e75

Browse files
adding simple example to explain the difference between :is and :where
1 parent ac424a6 commit 6949e75

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

is-where/is-where-example.html

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>:is() and :where(), examples and differences</title>
6+
7+
<style>
8+
html {
9+
font-family: sans-serif;
10+
font-size: 200%;
11+
}
12+
13+
:is(section.is-styling, aside.is-styling, footer.is-styling) a {
14+
color: red;
15+
}
16+
17+
:where(section.where-styling, aside.where-styling, footer.where-styling) a {
18+
color: orange;
19+
}
20+
21+
footer a {
22+
color: blue;
23+
}
24+
25+
26+
</style>
27+
</head>
28+
29+
<body>
30+
<article>
31+
<h2>:is()-styled links</h2>
32+
<section class="is-styling">
33+
<p>Here is my main content. This <a href="https://mozilla.org">contains a link</a>.
34+
</section>
35+
36+
<aside class="is-styling">
37+
<p>Here is my aside content. This <a href="https://developer.mozilla.org">also contains a link</a>.
38+
</aside>
39+
40+
<footer class="is-styling">
41+
<p>This is my footer, also containing <a href="https://github.com/mdn">a link</a>.
42+
</footer>
43+
</article>
44+
45+
<article>
46+
<h2>:where()-styled links</h2>
47+
<section class="where-styling">
48+
<p>Here is my main content. This <a href="https://mozilla.org">contains a link</a>.
49+
</section>
50+
51+
<aside class="where-styling">
52+
<p>Here is my aside content. This <a href="https://developer.mozilla.org">also contains a link</a>.
53+
</aside>
54+
55+
<footer class="where-styling">
56+
<p>This is my footer, also containing <a href="https://github.com/mdn">a link</a>.
57+
</footer>
58+
</article>
59+
60+
</body>
61+
62+
</html>

0 commit comments

Comments
 (0)