In my MVC application, I have used @Html.ActionLink
. I have set their styles to display them like a button, but the problem is that there are stome styles for a, a:link
, etc (I mean, all anchor behaviors) in the CSS file, and that is why the links on @Html.ActionLink
appears like links, and not plain text. Any idea to get rid of all anchor behavior for those particular @Html.Actionlink
controls?
Is using jQuery an option? You could write a function to remove the css from each link on startup.
$(document).ready(function() {
// to clear css from a specific item
$("#your-link-id").removeClass();
// to clear css from a bunch of links
$("your-selector a").each(function() {
$(this).removeClass();
});
});
Or you could create additional css classes that override the styles on your a
tags.
<style type="text/css">
.whatever { background-color:black !important; }
</style>
@Html.ActionLink("MyAction", "MyController", new { @class = "whatever" })