【发布时间】:2016-03-03 07:37:52
【问题描述】:
我知道在这个网站上有很多关于 full width bootstrap carousel 的问题,但我很困惑怎么做?! ,我花了一整天的时间来做这件事,但我做不到...... 我给所有标签 margin 和 padding 0px 和 width 100% 但它不起作用:/
Site.css
body {
padding-top: 0px;
padding-bottom: 0px;
}
.body-content {
padding-left: 0px;
padding-right: 0px;
}
input,
select,
textarea {
max-width: 280px;
}
.field-validation-error {
color: #b94a48;
}
.field-validation-valid {
display: none;
}
input.input-validation-error {
border: 1px solid #b94a48;
}
input[type="checkbox"].input-validation-error {
border: 0 none;
}
.validation-summary-errors {
color: #b94a48;
}
.validation-summary-valid {
display: none;
}
Index.cshtml
@model NP1.ViewModels.HomeVM
@{
ViewBag.Title = "Home Page";
}
@section scripts{
}
@section styles{
}
<!-- start carousel -->
<div class="carousel slide" data-ride="carousel" data-interval="3000">
<div class="carousel-inner">
@foreach (var item in Model.Carousels)
{
if (item == Model.Carousels.FirstOrDefault())
{
<div class="item active ">
<img style="height:450px; width:100%;" class="img-responsive" src="@Url.Content(item.CarouselImage.ToString())">
<div class="carousel-caption">
<h3>@item.CarouselSubject</h3>
<h4>@item.CarouselInfo</h4>
</div>
</div>
}
else
{
<div class="item">
<img style="height: 450px; width: 100%;" class="img-responsive" src="@Url.Content(item.CarouselImage.ToString())" />
<div class="carousel-caption">
<h3>@item.CarouselSubject</h3>
<h4>@item.CarouselInfo</h4>
</div>
</div>
}
}
</div>
Layout.cshtml:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>@ViewBag.Title - My ASP.NET Application</title>
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
@RenderSection("styles", false)
</head>
<body class="container-fluid" style="width:100% !important;padding:0px;">
@*overflow-x:hidden;*@
<div class="container body-content">
@RenderBody()
<footer></footer>
</div>
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", false)
</body>
</html>
【问题讨论】:
-
要么只放置呈现的 HTML 和 CSS,要么使用 Razor / ASP.NET 对其进行标记。
-
尝试将“container-fluid”类添加到您的 div 而不是正文中。默认情况下,body 始终是全宽的。
-
我做了你的解决方案,但它还没有工作@Franco
-
对不起,我不明白你的解决方案:/ @PraveenKumar
-
@shimaamini 矿山不是解决方案。
标签: html css twitter-bootstrap