我只想在我的ActionLink中设置部分文本的样式,我需要加号加粗。在纯 html 中,我可以这样做。
<a class="topMenu" href="#"><span style="font-weight:bold;">+</span>Invite User</a>
如果像这样尝试使用ActionLink:
@Html.ActionLink("<span style="font-weight:bold;">+</span>Invite User", "Invite", "Account", new { @class = "topMenu" })
它按原样呈现,就像一行文本一样。
有没有可能让它像纯HTML
一样风格?
我会使用Url.Action
<a class="topMenu" href="@Url.Action("Invite", "Account")">
<span style="font-weight:bold;">+</span>Invite User
</a>