css - 通过 less 和 MVC4 使用 Bootstrap

标签 css asp.net-mvc-4 twitter-bootstrap less

我是 Bootstrap 和 Less 的新手,正在苦苦挣扎..

我正在尝试从以下站点复制示例,但它们看起来不正常。我究竟做错了什么? http://bootsnipp.com/snipps/credit-card-payment-form-2

我已经通过 Nuget 安装了“Bootstrap Less Source”,还安装了“Bundle Transformer: LESS”以将 Less 转换为 CSS。 我还修改了我的 MVC BundleConfig.cs

bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
                    "~/Scripts/bootstrap.js"));
bundles.Add("~/Content/css").Include(
                    "~/Content/site.less",
                    "~/Content/bootstrap/bootstrap.less");

我更新了我的 View 以包含以下内容:

@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/bootstrap")

谢谢

最佳答案

看来我的问题与 Bootstrap 的版本有关。 我使用的是 v3.0.0.0,而我查看的样本是 v2.3.2

添加以下链接后,一切正常。

<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet">

谢谢

关于css - 通过 less 和 MVC4 使用 Bootstrap,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19088311/

相关文章:

html - 导航背景按钮悬停向上

asp.net-mvc-4 - Ninject.MVC WebViewPage _Layout.cshtml 注入(inject)为空

javascript - Bootstrap 导航栏固定顶部和 body 填充顶部

jquery - SVG 元素与之前的同级 SVG 重叠

javascript - 在父 div 的 css 子容器前面定位 z-index 问题?

c# - 异常 : "Value does not fall within the expected range" in ASP. NET MVC Controller

c# - 在两个下拉列表 mvc 4 之间连接

javascript - AngularJS:将表单字段的值设置为各种对象属性

html - 模态弹出窗口关闭,再次打开时不刷新

css - 你如何覆盖 bootstrap.min.css? Django