2015-07-28 18 views
0

我開始學習網頁設計,並對網格系統有一些疑問。 問題可能看起來很不妥,所以假設我對此不瞭解。 我有下面的代碼Bootstrap - 將中心的內容帶到中心

<!DOCTYPE html> 
<html> 
<head> 
    <meta charset="utf-8"> 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <title>Grid System</title> 
    <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> 
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> 
    <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> 
</head> 
<body> 
    <div class="container-fluid"> 
     <div class="row"> 
      <div class="col-md-4" style="background-color: yellow"> 
       <h4>Grid</h4> 
      </div> 
      <div class="col-md-4" style="background-color: grey"> 
       <h4 >System</h4> 
      </div> 
      <div class="col-md-4" style="background-color: yellow"> 
       <h4>Practice</h4> 
      </div> 
     </div> 
    </div> 
</body> 
</html> 

假設我想在中心打印「網格」的它的股利。我該怎麼做?

+0

http://goo.gl/xbDlnN –

回答

0

你可以嘗試

<div class="col-md-4 text-center" style="background-color: yellow"> 
    <h4>Grid</h4> 
</div> 
1

添加以下到H4:類= 「TEXT-中心」。這應該做到這一點。

0

如果你只想positionate網格字(它`格將在左的剩餘部分),你可以簡單地使用中心 HTML標籤:

<center><h4>Grid</h4></center> 

或者,如果你要移動的div來中心的全部內容,你可以在text-center類添加到div標記,因爲它是我的回答前面提到的:

<div class="col-md-4 text-center" style="background-color: yellow"> 
    <h4>Grid</h4> 
</div> 
0

使用:

<div class="col-md-4 text-center" style="background-color: grey"> 

實施例:jsFiddle