How can I exclude one html view in whole project to be applied from CSS?

ⅰ亾dé卋堺 提交于 2019-12-25 15:30:21

问题


I am working on Cross Platform application on DevExtreme. It includes 8-10 number of CSS files to be applied on my project for all the html views. CSS are having so many background-color:,background: properties set according to the theme(ios platform/android/win8 etc), which creates different layers in application html views.

But I want to create a html view in my project to be excluded from all these CSS and to make its background as TRANSPARENT.

How can I exclude one html view among many, where I can apply on selected CSS rather than all CSS linked in my inde.xml file ?

I hope my question is clear to understand. Please help. Thank you.


回答1:


If your HTML is inheriting CSS files from index.xml file then its not possible to exclude from getting css applied to it. but on other hand you can add extra class to overwrite all the properties which are getting applied to your HTML snipet.

for Eg.

.myhtml{
  background: transparent !important;
}

there are different techniques of overwriting inherited css properties and for that you need to understand how css is getting applied on the basis of number of selectors in the rule. here is more description: https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Getting_started/Selectors

Also please check

CSS Specificity Examples

First count the element names. This can be either HTML elements or XML elements. For ease of distinguishing them, I will write them in all-caps.

* { ... } = 0 
P { ... } = 1 
DIV P { ... } = 2 
H3 + P { ... } = 2

Count classes, pseudo-classes and non-ID attributes and multiply by 10.

.top { ... } = 10 
P.top { ... } = 11 
a:link { ... } = 11 
a.new:link { ... } = 21 
H3.bottom + p.top { ... } = 22 
DIV + *[title] { ... } = 11

IDs are the most specific, so count them and multiply by 100.

#a1 { ... } = 100 
#a1.red { ... } = 110 
H3#a1.red { ... } = 111 
blockquote #a2 { ... } = 101


来源:https://stackoverflow.com/questions/29768666/how-can-i-exclude-one-html-view-in-whole-project-to-be-applied-from-css

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!