Skip to content

Is it possible to protect legacy html within "sl-dialog|sl-include" from external styles? #398

Answered by claviska
trailsnail asked this question in Help
Discussion options

You must be logged in to vote

It's not possible to do with <sl-include>. The included content is added to the light DOM by design so you can style it. Otherwise, you wouldn't have any way to target it with arbitrary content. This works for most uses cases — just not yours.

If there's a strong need for it, you can do something like this: https://jsfiddle.net/mpq6j08d/

But know that your ability to style things from the outside will still be very limited. If you go that route, you'll probably want to add your own styles for spacing and other customizations: https://jsfiddle.net/mpq6j08d/1/

And if this is what you're looking for, it's really a higher-level component so I'd suggest going with LitElement to create it. 😄

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@trailsnail
Comment options

Answer selected by trailsnail
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants