Html 在引导旋转木马中居中图像?

Html 在引导旋转木马中居中图像?,html,Html,正如标题所述,我在引导旋转木马中无法使图像居中。这4幅图像为640x480,并保持与转盘左侧对齐。我已经把我的代码上传到codepen,如果有人能帮我解决这个问题,我将不胜感激。我已经研究了一些关于stackoverflow的解决方案,但是我还没有解决这个问题 http://codepen.io/omfggrenade/pen/wWOKER <body> <!-- Main jumbotron for a primary marketing message or call to

正如标题所述,我在引导旋转木马中无法使图像居中。这4幅图像为640x480,并保持与转盘左侧对齐。我已经把我的代码上传到codepen,如果有人能帮我解决这个问题,我将不胜感激。我已经研究了一些关于stackoverflow的解决方案,但是我还没有解决这个问题

http://codepen.io/omfggrenade/pen/wWOKER

<body>
<!-- Main jumbotron for a primary marketing message or call to action -->
<div class="jumbotron">
  <div class="container">
    <h1 align="center">The Big Cats</h1>
  </div>
</div>
<div class="container">
    <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
        <!-- Indicators -->
        <ol class="carousel-indicators">
            <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
            <li data-target="#carousel-example-generic" data-slide-to="1"></li>
            <li data-target="#carousel-example-generic" data-slide-to="2"></li>
            <li data-target="#carousel-example-generic" data-slide-to="3"></li>
        </ol>
        <!-- Wrapper for slides -->
        <div class="carousel-inner">
            <div class="item active">
                <img src="http://placehold.it/640x480">
            </div>
            <div class="item">
                <img src="http://placehold.it/640x480">
            </div>
            <div class="item">
                <img src="http://placehold.it/640x480">
            </div>
            <div class="item">
                <img src="http://placehold.it/640x480">
            </div>
        </div>
        <!-- Controls -->
        <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
            <span class="glyphicon glyphicon-chevron-left"></span>
        </a>
        <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
            <span class="glyphicon glyphicon-chevron-right"></span>
        </a>
        </div>
</div> <!-- /container -->
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
</body>
</html>

大猫

  • 使用Adam Azad的评论,有一个工作示例:

    
    

  • 尝试
    class=“center block”
    img上
    我尝试将class=“center block”添加到我的代码中,但它看起来没有任何影响。我开始认为这段代码是可恶的:(注意,这只会使图像水平居中。我不知道您是否更改了除class=“center block”以外的任何内容,但代码是有效的。当我添加代码片段时,它拒绝工作。在我复制并粘贴了您的示例后,它工作了!感谢您的贡献!