c# - 如何创建带有图像的 BMVC (TwitterBootstrapMVC) 链接?

标签 c# html twitter-bootstrap-3

有没有办法使用 BMVC(又名 TwitterBootstrapMVC5)来做到这一点?

示例 Razor 页面如下:

@{
    var alt = "microsoft homepage";    
    var url = "http://www.microsoft.com/";
    var logo = "~/Content/Images/microsoft_logo.png";
}

<!-- The old school way works just fine; also not using any variables -->
<a href="http://www.microsoft.com/">
    <img alt="microsoft homepage" src="~/Content/Images/microsoft_logo.png" />
</a>

<!-- This does not work using BMVC (the link works but fails at rendering the logo and has no alternate text) -->
@Html.Bootstrap().Link(@logo, @url)

换句话说,是否有一种“简短而有趣”的方法来使用 BMVC 创建链接(带有图像)?

最佳答案

https://www.twitterbootstrapmvc.com/Documentation#buttons-link 嗯?

我意识到这只是一个链接,但文档应该足够了

基本用法

@Html.Bootstrap().Link("awesome website", "http://www.website.net")

HTML 输出

<a href="http://www.website.net">awesome website</a>

我想我错过了什么。你想要那里,不是吗?

也许

@Html.Bootstrap().Link("<img src=\"@logo\"/>", "http://www.website.net")

?

关于c# - 如何创建带有图像的 BMVC (TwitterBootstrapMVC) 链接?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21029736/

相关文章:

c# - 如何将特定数据从一个 View 传输到另一个 View

html - @font-face 有多新,在将它添加到网站之前我需要了解什么?

html - CSS - 选中选择时显示 div

html - Bootstrap 3.x.x VS Alpha 4 - 向导 splinter

c# - 如何使用列表对象中 3 个属性的搜索条件加快 List<> 上的此 linq 查询

c# - 通过添加新接口(interface)而不是扩展现有接口(interface)来添加功能

c# - 将 DTO 传输到 ViewModel

php - 这段 html 代码是否在其中使用了 php 而没有 <?php ?> 标志?

php - 内容和标题不会显示在 Wordpress 的某些页面上

css - twitter-bootstrap-3' 中 'visible for all breakpoints but not for ' xs' 的任何简单方法