级联样式表未应用

时间:2014-12-12 20:57:43

标签: css asp.net

我使用的是Visual Developer 2008 Express Edition

stylesheet.css中

body {
    font-size: 12px;
    color: blue;
    font-family: arial, helvetica, verdana, sans-serif;
    text-decoration: underline;
}
.button{
    font-weight: bold;
    font-size: 14px;
    color: red;
    background-color: yellow;
    font-family: arial, helvetica, verdana, sans-serif;
}
.label{
    font-weight: bold;
    font-size: 18px;
    color: green;
    font-family: arial, helvetica, verdana, sans-serif;
}

CssDemo.aspx

enter image description here

当我在浏览器(IE 10)中查看CssDemo.aspx时,我得到了

enter image description here

为什么CSS中没有.button和.label覆盖主体?

1 个答案:

答案 0 :(得分:3)

在CSS中,.表示HTML中的类,如果要直接设置标记样式,请将该点留在CSS中。

button {...}
label  {...}

或使用您的ID

#Button1 {...}
#Label1  {...}
相关问题