-
Notifications
You must be signed in to change notification settings - Fork 1
/
attribute-matching.astro
59 lines (56 loc) · 1.41 KB
/
attribute-matching.astro
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
---
import ThemedCode from '../components/ThemedCode.astro';
import BaseLayout from '../layouts/BaseLayout.astro';
---
<style is:global>
.assets {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 300px));
grid-gap: 1rem;
padding: 1rem;
justify-content: center;
}
.asset p {
padding: 1rem;
margin-bottom: 1rem;
border-bottom: 1px solid var(--yellow);
}
.asset {
border: 1px solid var(--yellow);
}
.asset img {
width: 100%;
height: auto;
}
.asset h2 {
text-align: center;
font-size: 12px;
background: var(--yellow);
color: black;
margin: 0;
padding: 10px 2px;
}
.asset:has(img[src*="black"]) {
color: black;
background: white;
}
</style>
<BaseLayout title="Attribute Matching">
<div class="description">
<p>If the src attribute of an image includes the word "black", change the background to white and foreground to black.</p>
</div>
<ThemedCode lang="css" code=`.asset:has(img[src*="black"]) {
color: black;
background: white;
}` />
<div class="assets">
<div class="asset">
<p>Syntax Logo Yellow</p>
<img src="https://syntaxfm.github.io/brand/Syntax%20Wordmark%20Stacked%20-%20yellow.svg" />
</div>
<div class="asset">
<p>Syntax Logo Black</p>
<img src="https://syntaxfm.github.io/brand/Syntax%20Wordmark%20Stacked%20-%20black.svg" />
</div>
</div>
</BaseLayout>