4 ms·
For now, as Firefox support is not yet good, We can use nested rules in CSS. HTML: <my-custom-element> <p>This is a paragraph</p> </my-custom-element> CSS
by SynnVoid 2y ago
For now, as Firefox support is not yet good,
We can use nested rules in CSS. HTML:
<my-custom-element>
<p>This is a paragraph</p>
</my-custom-element>
CSS:
my-custom-element {
p {
color: blue;
}
}
By choosing a unique name for the custom element, we achieve near the same functionality as @scope.
- notpushkin 2y agoSvelte does a similar thing: when a component is compiled, it gets a scope class, and its own styles are placed in that scope.
- setr 2y agoIs this not the same as having a class with a unique name, and applying it to a parent div
- SynnVoid 2y agoQuite the same if you use nested css on the div.class-name-here. The diff is in the semantic. My post was about using nested CSS to "emulate" @scope
- dgraph_advocate 2y ago[dead]