mirror of
https://github.com/sveltejs/svelte.git
synced 2024-12-01 01:11:24 +01:00
6ad8240464
* docs: fix note about $derived * fix some other typos * revert one change * emdash tweak
22 lines
506 B
Markdown
22 lines
506 B
Markdown
---
|
|
title: Nested <style> elements
|
|
---
|
|
|
|
There can only be one top-level `<style>` tag per component.
|
|
|
|
However, it is possible to have a `<style>` tag nested inside other elements or logic blocks.
|
|
|
|
In that case, the `<style>` tag will be inserted as-is into the DOM; no scoping or processing will be done on the `<style>` tag.
|
|
|
|
```svelte
|
|
<div>
|
|
<style>
|
|
/* this style tag will be inserted as-is */
|
|
div {
|
|
/* this will apply to all `<div>` elements in the DOM */
|
|
color: red;
|
|
}
|
|
</style>
|
|
</div>
|
|
```
|