0

I have a Div tag in aspx page

<div id="mainDiv">
...........                                
</div>

Following style is working for it all right except background-color. Any changes made in following class also work. background-coloris also applied at design time in visual-studio but does not work at run-time. Any reasons?

#mainDiv
{
    width:95%;
    background-color:Silver;
    font-weight:bold;
    color:Maroon;    
}

Update Instead of background-color:Silver;, I have tried background-color:Silver !important;but no difference. However changing color:Maroon; to color:Blue; affects

Edit I have no other css files for this page only one css file is linked to it

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. Still do not know the reason

4

2 回答 2

0

该页面上的其他 CSS 可能存在一些冲突,因为这可以正常工作:

<div id="mainDiv">
    content here
</div>

CSS

#mainDiv {     
    width:95%;     
    background-color:Silver;     
    font-weight:bold;     
    color:Maroon;     
}

见这里:JS小提琴

于 2012-11-27T06:00:29.220 回答
0

而不是Silver尝试使用十六进制颜色代码

background-color:#C0C0C0; 
于 2012-11-27T05:56:20.540 回答