我有以下HTML代码:
<li>
<a href="dashboard.html"><i class="fa fa-dashboard fa-fw"></i> Dashboard</a>
</li>
代码将菜单项显示为以下图像:
我想要的是用Razor代码中的@ Html.ActionLink替换链接,我试试这个:
<li>
<i class="fa fa-dashboard fa-fw">@Html.ActionLink("Dashboard", "Index", "Home")</i>
</li>
但不幸的是,它将菜单项显示为:
也尝试过:
<li>
@Html.ActionLink("Dashboard", "Index", "Home", new { @class = "fa fa-dashboard fa-fw" })
</li>
样式覆盖文本字体并将结果显示为:
任何建议!
先谢谢
答案 0 :(得分:3)
试试这个:
<li>
<a href="@Url.Action("Dashboard", "Home")">
Dashboard <i class="fa fa-dashboard fa-fw"></i>
</a>
</li>