我正在使用Bootstrap 3创建a simple HTML template。 我有旋转木马的问题。在Firefox浏览器中查看时,图像无法正确对齐。
使用Firefox浏览器的屏幕截图:
使用Google Chrome浏览器的屏幕截图歌剧还可以:
我的轮播代码:
<div id="myCarousel" class="carousel slide" data-ride="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>
<div class="carousel-inner">
<div class="item active">
<img src="img/1.jpeg">
<div class="container">
<div class="carousel-caption">
<h1>
Example headline.
</h1>
<p>
Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.
</p>
<p>
<a class="btn btn-lg btn-primary" href="#" role="button">
Call to Action
</a>
</p>
</div>
</div>
</div>
<div class="item">
<img src="img/2.jpeg">
<div class="container">
<div class="carousel-caption">
<h1>
Another example headline.
</h1>
<p>
Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.
</p>
<p>
<a class="btn btn-lg btn-primary" href="#" role="button">
Register Now
</a>
</p>
</div>
</div>
</div>
<div class="item">
<img src="img/3.jpeg">
<div class="container">
<div class="carousel-caption">
<h1>
One more for good measure.
</h1>
<p>
Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.
</p>
<p>
<a class="btn btn-lg btn-primary" href="#" role="button">
Read Blog
</a>
</p>
</div>
</div>
</div>
</div>
<a class="left carousel-control" href="#myCarousel" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left">
</span>
</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">
<span class="glyphicon glyphicon-chevron-right">
</span>
</a>
</div>
我已经在<head>
标记中包含了jQuery,并且转换工作正常。只是图像位置有问题。
如何解决这个问题?
答案 0 :(得分:2)
添加一个clearfix解决了我在Firefox中遇到的问题。
<div id="myCarousel" class="carousel slide clearfix" data-ride="carousel">
答案 1 :(得分:1)
将转盘包裹在.container div中。这将使其与您的内容保持一致。
<div class="container">
<div id="myCarousel" class="carousel slide" data-ride="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>
<div class="carousel-inner">
<div class="item active">
<img src="img/1.jpeg">
<div class="container">
<div class="carousel-caption">
<h1>
Example headline.
</h1>
<p>
Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.
</p>
<p>
<a class="btn btn-lg btn-primary" href="#" role="button">
Call to Action
</a>
</p>
</div>
</div>
</div>
<div class="item">
<img src="img/2.jpeg">
<div class="container">
<div class="carousel-caption">
<h1>
Another example headline.
</h1>
<p>
Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.
</p>
<p>
<a class="btn btn-lg btn-primary" href="#" role="button">
Register Now
</a>
</p>
</div>
</div>
</div>
<div class="item">
<img src="img/3.jpeg">
<div class="container">
<div class="carousel-caption">
<h1>
One more for good measure.
</h1>
<p>
Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.
</p>
<p>
<a class="btn btn-lg btn-primary" href="#" role="button">
Read Blog
</a>
</p>
</div>
</div>
</div>
</div>
<a class="left carousel-control" href="#myCarousel" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left">
</span>
</a>
<a class="right carousel-control" href="#myCarousel" data-slide="next">
<span class="glyphicon glyphicon-chevron-right">
</span>
</a>
</div>
</div>