我正在使用Bootstrap和响应式定价表的代码段。考虑以下代码,如何将两个定价表项居中?我试过使用text-align(以及所有其他css对齐属性)以及html center和p标签。

    <div class="row">
        <div class="col-md-12">
            <div class="panel panel-default">
                <div class="panel-heading"><h2>Pricing</h2></div>
                <div class="panel-body">
                        <div class="col-xs-6 col-sm-6 col-md-3 col-lg-3">

                            <!-- PRICE ITEM -->
                            <div class="panel price panel-red">
                                <div class="panel-heading  text-center">
                                    <h3>STANDARD PLAN</h3>
                                </div>
                                <div class="panel-body text-center">
                                    <p class="lead" style="font-size:40px"><strong>$49 / week</strong></p>
                                </div>
                                <ul class="list-group list-group-flush text-center">
                                    <li class="list-group-item"><i class="icon-ok text-danger"></i> Unlimited
                                    </li>
                                    <li class="list-group-item"><i class="icon-ok text-danger"></i> 5GB/week bandwidth
                                    </li>
                                    <li class="list-group-item"><i class="icon-ok text-danger"></i> 24/7 support
                                    </li>
                                </ul>
                                <div class="panel-footer">
                                    <a class="btn btn-lg btn-block btn-danger" href="/checkout.php">BUY NOW!</a>
                                </div>
                            </div>
                            <!-- /PRICE ITEM -->


                        </div>

                        <div class="col-xs-6 col-sm-6 col-md-3 col-lg-3">

                            <!-- PRICE ITEM -->
                            <div class="panel price panel-blue">
                                <div class="panel-heading arrow_box text-center">
                                    <h3>GOLD PLAN</h3>
                                </div>
                                <div class="panel-body text-center">
                                    <p class="lead" style="font-size:40px"><strong>$69 / week</strong></p>
                                </div>
                                <ul class="list-group list-group-flush text-center">
                                    <li class="list-group-item"><i class="icon-ok text-info"></i> Unlimited</li>
                                    <li class="list-group-item"><i class="icon-ok text-info"></i> 50GB/week bandwidth
                                    </li>
                                    <li class="list-group-item"><i class="icon-ok text-info"></i> 24/7 support</li>
                                </ul>
                                <div class="panel-footer">
                                    <a class="btn btn-lg btn-block btn-info" href="/checkout.php">BUY NOW!</a>
                                </div>
                            </div>
                            <!-- /PRICE ITEM -->
                        </div>
                </div>
            </div><!-- /panel -->
        </div><!-- /.col -->
    </div><!-- /.row -->

最佳答案

只需在您的第一个价格项目中添加col-md-offset-3

这是关于它的引导程序doc

Bootply:http://www.bootply.com/evwWXqxTBk

HTML提取:

<div class="panel-heading"><h2>Pricing</h2></div>
<div class="panel-body">
       <div class="col-xs-6 col-sm-6 col-md-offset-3 col-md-3 col-lg-3">

09-25 13:35