Adi
Adi3y ago

Adi – 15-38 Jun 20

I am injecting JS widget script on webpage which loads JS as well styles for widget. Code is injected inside body tag but how can I make sure widget does not inherits CSS from body tag? How can I isolate widget from other web page CSS?? Note: I don't want to use iframe. Any other possible solutions?
2 Replies
ScriptyChris
ScriptyChris3y ago
you could put the widget into <iframe> so it won't inherit styles from already existing CSS if iframe is not an option then i guess you would have to manually exclude styles? like, you could try querying all your widget elements and put them all: unset style so they should have default values, instead of inherited from any CSS https://developer.mozilla.org/en-US/docs/Web/CSS/all (i think revert or initial will be better instead of unset, because it fallbacks to inherited stuff, which you want to avoid)
reactibot
reactibot3y ago
This thread hasn’t had any activity in 12 hours, so it’s now locked. Threads are closed automatically after 12 hours. If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/565213527673929729/988467858772209744