Skip to content

Commit

Permalink
Add docs for compound :global selector (sveltejs#6271)
Browse files Browse the repository at this point in the history
* Add docs for compound :global selector

Co-authored-by: Antony Jones <[email protected]>
  • Loading branch information
geoffrich and antony authored Jun 26, 2021
1 parent 142de01 commit 7bf3f20
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions site/content/docs/01-component-format.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,15 @@ To apply styles to a selector globally, use the `:global(...)` modifier.
to this component */
color: goldenrod;
}
p:global(.red) {
/* this will apply to all <p> elements belonging to this
component with a class of red, even if class="red" does
not initially appear in the markup, and is instead
added at runtime. This is useful when the class
of the element is dynamically applied, for instance
when updating the element's classList property directly. */
}
</style>
```

Expand Down

0 comments on commit 7bf3f20

Please sign in to comment.