I'm building a widget and to avoid css conflicts, I moved widget css into the Shadow root. But the parent website css style is affecting widget even then
Noticed error is happening because of this line on the parent website.
@media screen and (min-width: 768px) {
body {
font-size: 2rem;
}
}
The question, why is the body attribute in parent website affecting the Shadow root css. Isn't the purpose of Shadow root to avoid these sort of conflict?
How can I avoid this sort of problem?
I was trying to avoid !important but is there any other way?