CSS 未在 aspx 页面中应用。它在同一页面中定义 css 时起作用(href 引用 a.classname)但是当它被放入样式表时它不被应用。检查元素时,Chrome 表示正在应用用户代理样式表。
它说 a:-webkit-any-link 被应用到超链接(用户代理样式表)
知道为什么这不起作用吗?
我使用以下方式引用超链接的类:
<div class="summaryitem"><a ID="hl" runat="server" href="" class="someclassname">Hyperlink CSS should be applied to this</a>
这是我正在使用的 CSS:
a.someclassname:link {
font-weight: bold;
color: #555;
text-decoration:none;
}
a.someclassname:visited {
font-weight: bold;
color: #555;
text-decoration:none;
}
a.someclassname:hover {
font-weight: bold;
color: #555;
text-decoration:none;
}
a.someclassname:active {
font-weight: bold;
color: #555;
text-decoration:none;
}
最佳答案
我认为你没有正确添加你的样式表,它类似于这样吗
<link type="text/css" href="css/mylayout.css" rel="Stylesheet" />
关于c# - 未应用 ASP.NET href CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7552934/