我遇到了问题,试图让我的图像完全适合框。如何使twitter引导3图像轮播自动调整图像大小以适合轮播?
我希望他们保持长宽比,大小,尺寸,但是适合/缩小到旋转木马盒中。
,你可以看到我在想念着一半的图像,这是因为我有一组的高度,但我希望它自动调整大小以适应传送带盒如果是有道理的......
www.bollinbuild.co.uk/index.html是你可以看到旋转木马的行动。
每幅图像的尺寸都大于旋转木马的尺寸,所以我失去了一半的图像和质量。
im使用的是3张图片;
www.bollinbuild.co.uk/images/1.jpg
www.bollinbuild.co.uk/images/2.jpg
www.bollinbuild.co.uk/images/3.jpg
这是我的代码;
CSS
<style type="text/css">
.item{
text-align: center;
width: auto;
}
.bs-example{
margin: 10px;
}
.slider-size {
height: 300px; /* This is your slider height */
}
.carousel {
width:80%;
margin:0 auto; /* center your carousel if other than 100% */
}
</style>
HTML
<div class="container">
<div class="row">
<div class="bs-example">
<div id="myCarousel" class="carousel slide" data-ride="carousel">
<!-- Carousel 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>
<!-- Carousel items -->
<div class="carousel-inner">
<div class="active item">
<div style="background:url(/images/1.jpg) center center;
background-size:cover;" class="slider-size">
</div>
</div>
<div class="item">
<div style="background:url(/images/2.jpg) center center;
background-size:cover;" class="slider-size">
</div>
</div>
<div class="item">
<div style="background:url(/images/3.jpg) center center;
background-size:cover;" class="slider-size">
</div>
</div>
</div><!-- /.END CAROUSEL DIV -->
</div><!-- /.END MYCAROUSEL DIV -->
</div><!-- /.END BSEXAMPLE -->
</div>
</div>
我读到把图像作为一个div和作为背景的网址而不是在标签,但即时通讯仍然没有得到完整的图像坐在旋转木马上。
Replace the image with a container div using the image file as a background. Set width to 100% so it will expand to fill it’s container. Set the height of the slider so it will have a consistent display regardless of the image size. Win
源http://parkhurstdesign.com/improved-carousels-twitter-bootstrap/
不,我想旋转木马是我已经设置它的大小,80%的宽度和300px的高度。我想要这些图像适合这个......但3张图像的高度是600px +,因此我没有把整个图像放到盒子里。 我想调整大小,如果这有道理 – Grovesy 2014-08-29 03:52:02