I am building a pluggable chatbot widget using react. I am aiming for a chatbot widget which you can use on any site sort of like rasa-webchat.
When I used it on some of the sites I found its styles being overridden by the base site on which the widget was added. On debugging I found out that the base site is using styles with !important
in their CSS sort of like
a {
color: blue !important;
}
which really screwed up my widget styling, so no matter how specific styles I used in my widget CSS it will be overwritten by the base site styles having !important
.
I found 'css-modules','react-jss' libraries to scope css but none was able to override !important, the only way I found is to add !important
to all the styles in my CSS but that is considered a bad approach and since I am using material-ui to build my chatbot I believe it will be hard to add !important
to each and every style in the library itself.
Is there any way with which I can ensure that my widget styling will look same irrespective of base site CSS ?