forked from WebKit/WebKit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoverlay-selectors.html
44 lines (42 loc) · 1.14 KB
/
overlay-selectors.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<style>
p {
position: fixed;
right: 20px;
bottom: 20px;
margin: 0;
}
.expected {
position: absolute;
width: 300px;
height: 100px;
background-image: linear-gradient(to right, rgba(111, 168, 220, 0.66) 33.3%, transparent 33.3%, transparent 66.6%, rgba(111, 168, 220, 0.66) 66.6%);
}
.actual, .actual::before {
display: inline-block;
width: 100px;
height: 100px;
}
.actual {
position: relative;
}
.actual::before {
position: absolute;
left: 200px;
content: "";
}
</style>
<body>
<div id="test1">
<div class="expected" hidden></div>
<div class="actual"></div>
</div>
<p>Inspect this page and hover the `<code>.actual, .actual::before</code>` CSS selector in the Styles panel of the details sidebar in the Elements tab. Click <button>Show Expected</button> to compare with the expected result.</p>
<script>
let showingExpected = false;
document.querySelector("button").addEventListener("click", (event) => {
showingExpected = !showingExpected;
for (let node of document.querySelectorAll(".expected"))
node.hidden = !showingExpected;
});
</script>
</body>