水平对齐旋转木马控制在中心?

时间:2014-02-23 13:37:33

标签: html css twitter-bootstrap carousel

框架:bootstrap 3

我想将旋转木马控件水平对齐,如下图所示:

enter image description here

这是我的旋转木马的HTML代码

<div class="carousel-inner">

<div class="item active">
    <div class="row">
        <div class="col-md-7">
            <h3><button type="button" class="btn btn-default btn-sm"><span class="glyphicon glyphicon-list"></span></button>Lorel Ipsum</h3>
            <p>Dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip
                ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie</p>
        </div>
    </div>
</div>
<div class="item">
    <div class="row">
        <div class="col-md-7">
            <h3><button type="button" class="btn btn-default btn-sm"><span class="glyphicon glyphicon-list"></span></button>Lorel Ipsum 2</h3>
            <p>Dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip
                ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie</p>
        </div>
    </div>
</div>

</div>
<a class="left carousel-control" href="#myCarousel" data-slide="prev">
  <button type="button" class="btn btn-default">Prev</button>
</a>

<a class="right carousel-control" href="#myCarousel" data-slide="next">
 <button type="button" class="btn btn-default">Next</button>
</a>
</div>

1 个答案:

答案 0 :(得分:1)

在外部div上添加此类

.centerAlign{
    width: 400px; //some width you want
    position: relative;
    margin: 0px auto; //to align in center
    display: table;
}