CSS isn’t being applied in aspx page. It works when the css is defined in the same page (href references a.classname) but when it is put into a stylesheet it is not applied. When element is inspected, Chrome says user agent stylesheet is being applied.
It says that a:-webkit-any-link is being applied to hyperlinks (user agent stylesheet)
Any ideas why this isn’t working?
I reference the class for the hyperlink using:
<div class="summaryitem"><a ID="hl" runat="server" href="" class="someclassname">Hyperlink CSS should be applied to this</a>
Here’s the CSS I’m using:
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;
}
If you’re in a partial view, just be sure the parent view includes the CSS ref.
EDIT: wow got a similar problem a few minutes ago. I’ve solved testing my view with Chrome and using the network auditing feature (at the page hit F12, click on Network and then reload your page). Should tell you at least if your CSS is correctly sent to the browser. (my problem was I wasn’t referencing the correct CSS).
EDIT-2:
I usually refer to CSS via:
But I’m using MVC with Razor views, I’ve noticed that putting CSS out of the Content folder can be nasty on ASP.NET.
HTH