2019Bootstrap4.xの回答を更新
最近のブラウザはをサポートするようになったのでobject-fit
、ここで説明されているように、より良いオプションがあります。
Bootstrap3.xの元の回答
この回答は少し遅れていることに気付きましたが、Bootstrapカルーセルでも同様の課題に直面しました。100%の高さで機能するには、カルーセルとその親コンテナも100%の高さである必要があります。
BootstrapCSSクラスにいくつかのオーバーライドを追加しました。
html,body{height:100%;}
.carousel,.item,.active{height:100%;}
.carousel-inner{height:100%;}
.fill{width:100%;height:100%;background-position:center;background-size:cover;}
次に、カルーセルに応じて「fill」クラスを追加します。
<div class="container fill">
<div id="myCarousel" class="carousel slide">
<div class="carousel-inner">
<div class="active item">
<div class="fill" style="background-image:url('//www.portalapp.com/images/greengrass.jpg');">
<div class="container">
<h1 class="pull-left pull-middle light-color"><strong><a href="#">Slide 1</a></strong></h1>
</div>
</div>
</div>
<div class="item">
<div class="fill" style="background-image:url('//placehold.it/1024x700');">
<div class="container">
<h1 class="pull-left pull-middle light-color"><strong><a href="#">Slide 2</a></strong></h1>
</div>
</div>
</div>
</div>
<div class="pull-center">
<a class="carousel-control left" href="#myCarousel" data-slide="prev">‹</a>
<a class="carousel-control right" href="#myCarousel" data-slide="next">›</a>
</div>
</div>
</div>
これが実際の例です:http://bootply.com/59900