Is it possible to exclude all CSS styles for one specific container div?

I am having problems using font-face on my website. I can make it work by testing it in an html file with its own style, but not if I include other stylesheets.

I tried redefining the slings by putting the stylesheets in a different order and so on, but nothing works.

So, I am wondering if it is possible to exclude all CSS and use only css from one css file for a specific div container?

(Without using iframe )

+4
source share
2 answers

Unfortunately no, it is not possible to simply clear or reset the styles for a particular container from css that it inherited. You must redefine each style you want manually.

What you can do is that you can use the namespace for your classes, and all you need to worry about is the styles of the elements that you could define by default at the beginning of your stylesheet. For example, something like:

 div,table,span,img,p{ margin: 0; padding: 0; border: 0; font-weight: normal; font-style: normal; font-size: 100%; line-height: 1; font-family: inherit; text-align: left; } 

You can of course add! important for the ones you need and add more items to the list. If you canโ€™t trust or donโ€™t know the other styles that will be loaded and applied to your page, I think itโ€™s best to start with an empty slate.

+4
source

No, you canโ€™t. There is no such exclusion mechanism in CSS or HTML.

You are probably solving the problem, but you have not described it. You should describe in the new question what you want, what you tried and how it fails. With real code and / or URL.

0
source

All Articles