简体   繁体   English

无法覆盖CSS类!内联样式很重要

[英]Not able to overriding css class !important with inline style

I am using bootstrap-select for custom combo box, in their external css the have give class 我正在使用bootstrap-select作为自定义组合框,在其外部CSS中具有Give类

.hide{ display: none !important; }. 

Im also using same class .hide{display:none}. 我还使用相同的类.hide {display:none}。 But without !important. 但没有!重要。 In all the area I just remove it if I want to show the element. 如果要显示元素,则在所有区域中都将其删除。 In some area I have used jQuery slide down instead of removing ".hide" class. 在某些方面,我使用jQuery向下滑动而不是删除“ .hide”类。 Bootstrap-Select affectes where I have used jQuery slide down. Bootstrap-Select影响了我使用jQuery的地方。

Kindly assist me. 请帮助我。

如果要显示使用类名.hide隐藏的元素,则应删除该类而不是设置内联样式。

document.querySelector( '.myComboBox' ).classList.remove( 'hide' );

You can also create your own class to hide elements such as .invisi { display:none; 您也可以创建自己的类来隐藏.invisi {display:none; } this will then work when using JQuery functions such as .show() and .fadeIn() }在使用诸如.show()和.fadeIn()之类的JQuery函数时,这将起作用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM