Slots and scoped css #8309
-
I ran into the issue with Vue3 with slots and scoped css. Basically, I want to render some html based on component specific/scoped css. Lets call the component
This result in all css selectors in The problem is that when I use
the resulting html will not have I would expect h1 to have scope attribute, because in rendering in the context of How one should work around it? Is it expected behavior and why? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You have to use the /* css/styler.css */
article.main {
background-color: black;
}
article.main :deep(h1) {
color: red;
} You can find the doc about deep selectors for css in vue sfc here : https://vuejs.org/api/sfc-css-features.html#deep-selectors |
Beta Was this translation helpful? Give feedback.
You have to use the
:deep()
pseudo-class to apply styles to child elements of a component.You can find the doc about deep selectors for css in vue sfc here : https://vuejs.org/api/sfc-css-features.html#deep-selectors