[英]background-color not working css
I have a Div tag in aspx page我在 aspx 页面中有一个 Div 标签
<div id="mainDiv">
...........
</div>
Following style is working for it all right except background-color
.除了background-color
之外,以下样式都可以正常工作。 Any changes made in following class also work.在后续课程中所做的任何更改也有效。 background-color
is also applied at design time in visual-studio but does not work at run-time. background-color
也在视觉工作室的设计时应用,但在运行时不起作用。 Any reasons?有什么理由吗?
#mainDiv
{
width:95%;
background-color:Silver;
font-weight:bold;
color:Maroon;
}
Update Instead of background-color:Silver;
更新而不是background-color:Silver;
, I have tried background-color:Silver !important;
,我试过background-color:Silver !important;
but no difference.但没有区别。 However changing color:Maroon;
然而color:Maroon;
to color:Blue;
给color:Blue;
affects影响
Edit I have no other css files for this page only one css file is linked to it编辑我没有此页面的其他 css 文件只有一个 css 文件链接到它
Edit I had two divs inside the mainDiv
there style was float:left
when I removed float:left
I was able to see the changes in background-color
of mainDiv
.编辑我在mainDiv
中有两个 div 样式是float:left
当我删除float:left
我能够看到mainDiv
background-color
的变化。 Still do not know the reason还是不知道原因
而不是Silver
尝试使用十六进制颜色代码
background-color:#C0C0C0;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.