如何以HTML5为中心? [英] How to center on HTML5?

查看:66
本文介绍了如何以HTML5为中心?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我在这里有此代码,这是我将在我的网站上提供的计划,但是我已注释掉其中一个计划,现在我希望仅显示3个计划,所以我将如何将所有3个计划居中您可以从图片中看到左侧的更多内容?

So i have this code here Which is the plans i will be providing on my website, but i have commented out one of the plans and now im looking to just display 3 plans, so how would i center all 3 of them as you can see by the picture, there more to the left?

              <!-- Row fuid-->
              <div class="row">
                  <!-- Item table -->
                  <div class="col-sm-6 col-md-4 col-lg-3">
                      <div class="item_table">
                          <div class="head_table">
                              <h1>FREE</h1>
                              <h2>£ 0.00  <span>/ Mo</span></h2>
                          </div>
                          <ul>  
                              <li class="color">2 GB HDD</li>
                              <li>25GB Bandwidth</li>
                              <li class="color">1 E-mail Account</li>
                              <li>1 Sub Domains</li>
                              <li class="color">cPanel/Site Creator</li>
                              <li>1 FTP Account</li>
                              <li class="color">1 Cron Job</li>
                              <li>1 Addon Domain</li>
                              <li class="color">1 Parked Domain</li>
                          </ul> 
                          <a href="signup.html" class="button">Order Now</a>
                      </div>
                  </div>
                  <!-- End Item table -->

                  <!-- Item table -->
                  <div class="col-sm-6 col-md-4 col-lg-3">
                      <div class="item_table">
                          <div class="head_table">
                              <h1>PREMIUM</h1>
                              <h2>£ 0.99  <span>/ Mo</span></h2>
                          </div>
                          <ul>  
                              <li class="color">30 GB HDD</li>
                              <li>1000GB Bandwidth</li>
                              <li class="color">1024MB RAM</li>
                              <li>2 Dedicated IP Addresses</li>
                              <li class="color">cPanel/WHM Included</li>
                              <li>Open VZ Included</li>
                          </ul> 
                          <a href="signup.html" class="button">Order Now</a>
                      </div>
                  </div>
                  <!-- End Item table -->

                  <!-- Item table -->
                  <!--<div class="col-sm-6 col-md-4 col-lg-3">
                      <div class="item_table">
                          <div class="head_table">
                              <h1>V.I.P</h1>
                              <h2>£ 2.00  <span>/ Mo</span></h2>
                              <!--<h5>Or  $ 150.5 Yearly!</h5>
                          </div>
                          <ul>  
                              <li class="color">30 GB HDD</li>
                              <li>1000GB Bandwidth</li>
                              <li class="color">1024MB RAM</li>
                              <li>2 Dedicated IP Addresses</li>
                              <li class="color">cPanel/WHM Included</li>
                              <li>Open VZ Included</li>
                          </ul> 
                          <a href="www.clearhostsolutions.com/signup.html" class="button">Order Now</a>
                      </div>
                  </div>-->
                  <!-- End Item table -->


推荐答案

我认为有两个答案...

I think there's two answers...

css具有 text-align:center 并具有bootstrap的12列布局,您需要给每列4个我使用的col-sm-4,因为jsfiddle的窗口很小。

css has text-align: center and with bootstrap's 12 column layout, you need to give each column 4 each I used the col-sm-4 since jsfiddle's window is small.

这是我的示例。 http://jsfiddle.net/N7mvN/ 确保将显示窗口打开得更宽才能看到它。

here's my example. http://jsfiddle.net/N7mvN/ make sure to pull the display window open wider to see it.

这是html

<!-- Row fuid-->
<div>
              <div class="row" style="margin:0 auto">
                  <!-- Item table -->
                  <div class="col-sm-4">
                      <div class="item_table" style="background-color:red">
                          <div class="head_table">
                              <h1>FREE</h1>
                              <h2>£ 0.00  <span>/ Mo</span></h2>
                          </div>
                          <ul>  
                              <li class="color">2 GB HDD</li>
                              <li>25GB Bandwidth</li>
                              <li class="color">1 E-mail Account</li>
                              <li>1 Sub Domains</li>
                              <li class="color">cPanel/Site Creator</li>
                              <li>1 FTP Account</li>
                              <li class="color">1 Cron Job</li>
                              <li>1 Addon Domain</li>
                              <li class="color">1 Parked Domain</li>
                          </ul> 
                          <a href="signup.html" class="button">Order Now</a>
                      </div>
                  </div>
                  <!-- End Item table -->

                  <!-- Item table -->
                  <div class="col-sm-4">
                      <div class="item_table" style="background-color:green">
                          <div class="head_table">
                              <h1>PREMIUM</h1>
                              <h2>£ 0.99  <span>/ Mo</span></h2>
                          </div>
                          <ul>  
                              <li class="color">30 GB HDD</li>
                              <li>1000GB Bandwidth</li>
                              <li class="color">1024MB RAM</li>
                              <li>2 Dedicated IP Addresses</li>
                              <li class="color">cPanel/WHM Included</li>
                              <li>Open VZ Included</li>
                          </ul> 
                          <a href="signup.html" class="button">Order Now</a>
                      </div>
                  </div>
                  <!-- End Item table -->

                  <!-- Item table -->
                  <div class="col-sm-4">
                      <div class="item_table" style="background-color:blue">
                          <div class="head_table">
                              <h1>V.I.P</h1>
                              <h2>£ 2.00  <span>/ Mo</span></h2>
                              <h5>Or  $ 150.5 Yearly!</h5>
                          </div>
                          <ul>  
                              <li class="color">30 GB HDD</li>
                              <li>1000GB Bandwidth</li>
                              <li class="color">1024MB RAM</li>
                              <li>2 Dedicated IP Addresses</li>
                              <li class="color">cPanel/WHM Included</li>
                              <li>Open VZ Included</li>
                          </ul> 
                          <a href="www.clearhostsolutions.com/signup.html" class="button">Order Now</a>
                      </div>
                  </div>
                  <!-- End Item table -->
    </div>
</div>

和一些额外的CSS

.item_table {
    margin:1.5em;
    padding:1em;
    text-align:center;
}

这篇关于如何以HTML5为中心?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆