【发布时间】:2016-12-27 08:53:53
【问题描述】:
我有一张图片的幻灯片,但图片没有完整显示。 我该如何解决这个问题?无论其高度如何,我都想显示图像。 这张图片显示了我的问题。这是显示在我的幻灯片中的图像的一部分
html,
body {
height: 85%;
}
.carousel,
.item,
.active {
height: 100%;
}
.carousel-inner {
height: 100%;
}
/* Background images are set within the HTML using inline CSS, not here */
.fill {
width: 100%;
height: 100%;
background-position: center;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
-o-background-size: cover;
}
<!-- Full Page Image Background Carousel Header -->
<header id="myCarousel" class="carousel slide">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
</ol>
<!-- Wrapper for Slides -->
<div class="carousel-inner">
<div class="item active">
<!-- Set the first background image using inline CSS below. -->
<div class="fill" style="background-image:url('img/slide1.jpg');"></div>
<div class="carousel-caption">
</div>
</div>
<div class="item">
<!-- Set the second background image using inline CSS below. -->
<div class="fill" style="background-image:url('img/slide2.jpg');"></div>
<div class="carousel-caption">
</div>
</div>
<div class="item">
<!-- Set the third background image using inline CSS below. -->
<div class="fill" style="background-image:url('img/slide3.jpg');"></div>
<div class="carousel-caption">
</div>
</div>
</div>
<!-- Controls -->
<a class="left carousel-control" href="#myCarousel" data-slide="prev">
<span class="icon-prev"></span>
</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">
<span class="icon-next"></span>
</a>
</header>
【问题讨论】:
-
抱歉,不确定要包含哪些内容才能将其转换为有效的 sn-p。无论如何,我想答案可能是将
background-size:cover更改为background-size:contain。 -
@MrLister 当我把它包含图像重复 x
-
谢谢我用这个宽度解决它:100%;高度:100%;背景位置:中心; -webkit-background-size:包含; -moz-background-size:包含;背景尺寸:包含; -o-背景大小:包含;背景重复:不重复;背景尺寸:100% 100%;背景来源:内容框;
标签: html image css twitter-bootstrap-3 slideshow