Search code examples
cssasp.netasp.net-mvc-4html.actionlink

CSS not working on Html.ActionLink


I'm trying to add CSS to an ActionLink to make it a clickable image, but it's not working.

Here is my ActionLink:

 @Html.ActionLink("Logout", "Logout", "Account", new { @class="logoutButton"})

Here is the CSS:

.logoutButton {
background: url(../Images/logout_icon.png) no-repeat;
}

Can somebody help?


Solution

  • Are you sure your directory path is correct?

    Can you use your tools in your browser (F12 normally) to verify that path is finding your resource, or even that the CSS has "found" your object?

    I use the right-click "inspect" frequently to see what CSS is finding and modifying my object.