We are having rich text editor in which we can insert html. if any input contains <style>
tag then the css is applied to entire window.
is it possible to restrict that CSS to be applied within <div>
not entire window?
We are having rich text editor in which we can insert html. if any input contains is it possible to restrict that CSS to be applied within |
|||||||||||||||||||||
closed as off-topic by MichaelT, GlenH7, Dynamic, Bart van Ingen Schenau, Kilian Foth Apr 10 at 15:19
|
|||||||||||||||||||||
|
Yes, it is possible. HTML 5 supports the scoped attribute on style tags, which restricts styles defined within to being applied only to the descendants of its parent. An example below (shamelessly pulled and edited from the MDN article). You could check your user input for style tags and add the
|
|||||||||||||
|