开发者

using CSS in ActionLink inside HTML.Partial

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 {
te开发者_StackOverflowxt-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.


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.


You should double @@ the HTML attribute:

@Html.ActionLink("Sign In", "LogOn", "Account", null, new { @@class = "signin" })
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜