Css 带有Twitter引导的ActionLink上的图像
我现在有一个按钮,在我的MVC应用程序中呈现为:Css 带有Twitter引导的ActionLink上的图像,css,asp.net-mvc,twitter-bootstrap,Css,Asp.net Mvc,Twitter Bootstrap,我现在有一个按钮,在我的MVC应用程序中呈现为: @Html.ActionLink("Delete", "DeleteTransfer", "Transaction", new { transferId = (Model.Id) }, new { @class = "btn btn-danger", @onclick = "return confirm('Are you sure you want to delete this Transfer?')" }) 我想使用Twitter引导类添加一
@Html.ActionLink("Delete", "DeleteTransfer", "Transaction", new { transferId = (Model.Id) }, new { @class = "btn btn-danger", @onclick = "return confirm('Are you sure you want to delete this Transfer?')" })
我想使用Twitter引导类添加一个图标。但是,为此,代码如下所示:
<button class="btn btn-danger"><i class="icon-white icon-trash"></i> Delete</button>
删除
如何在ActionLink中应用此功能?按钮中嵌入了一个图像(i)。试试:
<a class="btn btn-danger"
href="@Url.Action("DeleteTransfer", "Transaction", new { transferId = (Model.Id) })"
onclick = "return confirm('Are you sure you want to delete this Transfer?');"
>
<i class="icon-white icon-trash">Delete</i>
</a>
根据bootstrap文档()的说法,图标可能是一种方法。以下是在按钮上放置图标的示例:
<button type="button" class="btn btn-default btn-lg">
<span class="glyphicon glyphicon-star"></span> Star
</button>
我还尝试将ActionLink()
放在
中,结果相同。我尝试将css与text wrap:none一起使用代码>和空白:nowrap代码>但这也不起作用
所以我相信答案是需要覆盖扩展以接受glyphicon的另一个参数。除非有人能耍把戏让它停止包装。看看如何创建自定义html帮助程序,生成你想要的html。这不是一个很好的答案,因为你没有将图像放在ActionLink上,你只是创建了一个超链接。
<button type="button" class="btn btn-default btn-lg">
<span class="glyphicon glyphicon-star"></span> Star
</button>
<span class="glyphicon glyphicon-star"></span>@Html.ActionLink("Delete", "DeleteTransfer")