I'm looking to develop a plugin that can be added to many different websites, but I need to limit the possibility of the existing CSS on the site effecting my plugin.
Obviously I can have a container around my plugin which is the prefix to all my CSS rules, but how can I prevent an existing rule such as this cocking things up?:
a { display: none; }. Is there some sort of generic CSS reset I can do on all tags that would normalize, in this case, A tags to display inline?
!importantoperator. Its use is often seen as an antipattern, but in this case, it might be just what the doctor ordered.!importantis going to be mostly unnecessary. I would advise against using it even in this case unless there are inline styles. Considering you are already planing on prefixing your rules with some class or ID, it should naturally increase the specificity. Just make sure your plugin style sheets are loaded after the main one and maintain that specificity and it should be fine in most cases. Otherwise, look into CSS reset style sheets and administer where needed (such as the rules for anchors for example).