HTML,CSS - 我如何转移<a> style to ActionLink</a>

时间:2013-03-07 11:02:53

标签: css asp.net-mvc

我有一个我下载的CSS,它有一个漂亮的菜单,有链接样式,hover等。

因为我在MVC中开发我使用

@Html.ActionLink("דף הבית", "Index", "Home", null, new { id = "something" }

我很困惑CSS中的菜单。 我如何理解并“翻译”,因此它将适用于HTML.ActionLink而不是

<a href="#"><span class="l"></span><span class="r"></span><span class="t">Menu Item</span></a>

2 个答案:

答案 0 :(得分:2)

您可以将所有样式放在一个类中,然后将类提供给ActionLink

   @Html.ActionLink("דף הבית", "Index", "Home", null, new { id = "something", @class="something you give to anchor" }

例如

a,.anchorstyle{
text-decoration:none;
color:blue;

}

<a href="#">hello </a>

<a class="anchorstyle" href="#">hello </a>

或 将此类添加到ActionLink

   @Html.ActionLink("דף הבית", "Index", "Home", null, new { id = "something", @class="anchorstyle" }

答案 1 :(得分:1)

@Html.ActionLink("דף הבית", "Index", "Home", null, new { id = "something", @class="someCssClass" }

OR

@Html.ActionLink("דף הבית", "Index", "Home", null, new { id = "something", @class="someCssClass", @style="color:white;" }