[英]Css not applying when include js file
I am applying custom css to infrajistics webmonthcalendercontrol when I add custom day I apply css class which I define it on site.css, but when I include contextmenu.js
file and some javascript function the css is not working, 添加自定义日期时,我将自定义css应用到基础设施的webmonthcalendercontrol中,我在site.css上应用了它定义的css类,但是当我包含
contextmenu.js
文件和某些javascript函数时,css无法正常工作,
.myUnavalable
{
color:Green;
background-color:Green;
text-decoration:blink;
}
in contextmenu.js style for menu div is define. 在contextmenu.js中定义了菜单div的样式。
ContextMenuDiv.id = 'ContextMenu';
ContextMenuDiv.style.position = 'absolute';
ContextMenuDiv.style.backgroundColor = 'transparent';
ContextMenuDiv.style.border = '2px outset transparent';
ContextMenuDiv.style.verticalAlign = 'top';
ContextMenuDiv.style.textAlign = 'left';
ContextMenuDiv.style.visibility = 'hidden';
ContextMenuDiv.style.width = (Width + 11) + 'px';
I want to change background color of the customdate
. 我想更改
customdate
背景颜色。 How to overcome this problem? 如何克服这个问题?
You've answered your own question. 您已经回答了自己的问题。 Look at the code you posted.
查看您发布的代码。 Your class:
你的班:
background-color:Green;
The javascript: JavaScript:
ContextMenuDiv.style.backgroundColor = 'transparent';
The javascript is overwriting your style. JavaScript会覆盖您的样式。 Either remove the background color from the JS file or change your class to be this:
从JS文件中删除背景色或将您的类更改为以下形式:
background-color:Green !important;
And take out the "Blink"... that's the UI equivalent of smacking your page viewer in the face with a rotten fish. 并取出“闪烁” ...,它的UI等同于用烂鱼砸你的页面查看器。
use firebug and check which styles your control is taking. 使用萤火虫并检查您的控件采用哪种样式。 probably your
.js
file have its own css which overwrite your custom css
. 可能您的
.js
文件具有自己的CSS,该CSS会覆盖您的自定义css
。
if so, try using !important
in your css
如果是这样,请尝试在
css
使用!important
eg. 例如。
.myUnavalable
{
background-color:Green !important;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.