0

I'm having problems getting my CSS class to style an actionlink inside a html.partial. In building my test site, I've used the template beginning from ASP.NET and the standard login portion. My Index page works fine as the _Layout.cshtml does reference my css page. In _LogOnPartial, I have the following listed (there is more but this is what's important I believe):

else {
<text>
<ul style="display:inline;">;
<li style="list-style:none; display:inline;">
@Html.ActionLink("Sign In", "LogOn", "Account", null, new { @class = "signin" })
</li>

My CSS for "signin" is:

.signin {
text-decoration: none;
font-family: Helvetica, Arial, sans-serif;
font-weight: bold;
color: White;
}

When I look at the source for the page after debugging, it shows:

<a class="signin" href="/Account/LogOn">Sign In</a>

That looks right but it's not showing it correctly. The font isn't Helvetica and it is underlined and not white. I don't reference the css sheet in the LogOnPartial but I didn't think I'd have too. Any help would be greatly appreciated.

Ken D
  • 5,880
  • 2
  • 36
  • 58
liquidanswer
  • 328
  • 4
  • 9

2 Answers2

1

I would download firefox and firebug then open the site up in firefox. Use firebug to look at the CSS associated with the link. All of the above information looks correct to me which leads me to believe you have something else more specific in the CSS which is modifying your link.

m4tt1mus
  • 1,642
  • 14
  • 24
  • 1
    +1 I'm Agree. You can also use the Firefox developer toolbar to get all the css rules that are currently applying to your element. – Jonathan Mar 22 '11 at 16:39
1

You should double @@ the HTML attribute:

@Html.ActionLink("Sign In", "LogOn", "Account", null, new { @@class = "signin" })
Community
  • 1
  • 1
George Stocker
  • 57,289
  • 29
  • 176
  • 237