mirror of https://github.com/sveltejs/svelte
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
464 B
38 lines
464 B
4 years ago
|
<script>
|
||
|
let array = [1];
|
||
|
</script>
|
||
|
|
||
|
<style>
|
||
|
/* boundary of each */
|
||
|
.a + .b {
|
||
|
color: green;
|
||
|
}
|
||
|
.c + .d {
|
||
|
color: green;
|
||
|
}
|
||
|
/* if array is empty */
|
||
|
.a + .d {
|
||
|
color: green;
|
||
|
}
|
||
|
/* if array has multiple items */
|
||
|
.c + .b {
|
||
|
color: green;
|
||
|
}
|
||
|
/* normal sibling */
|
||
|
.b + .c {
|
||
|
color: green;
|
||
|
}
|
||
|
/* not match */
|
||
|
.a + .c {
|
||
|
color: green;
|
||
|
}
|
||
|
</style>
|
||
|
|
||
|
<div class="a" />
|
||
|
|
||
|
{#each array as item}
|
||
|
<div class="b" />
|
||
|
<div class="c" />
|
||
|
{/each}
|
||
|
|
||
|
<div class="d" />
|