2015-04-06 125 views
1

我需要使用引导3.我写了下面的HTML代码到中心的IMG圈格内glyphicon到中心的圆内glyphicon:如何使用引导3

<section> 
     <div class="container"> 
      <div class="col-lg-4"> 
       <div class="img-circle center-block"> 
        <span class="glyphicon glyphicon-map-marker glyphicon-aligned-center"></span> 
       </div> 
       <p class="aligned-paragraph-address text-center">#123 45678 901 <br/> St NW Pellentesque habitant</p> 
      </div> 
     </div> 
</section> 

在CSS我写了下面的代码:

.img-circle { 
    width: 125px; 
    height: 125px; 
    background-color: #f5c63b; 
} 

.aligned-paragraph-address { 
    padding: 1em; 
} 

.glyphicon-envelope, .glyphicon-phone, .glyphicon-map-marker { 
    font-size: 50px; 
    color: #ffffff; 
} 

.glyphicon-aligned-center { 
    top: 35px; 
    left: 35px; 
} 

它的工作,但我不觉得这是最好的做法。所以我需要一个帮助来做一个专业人士。

回答

0

通常当我需要中心的东西,我使用余量:0汽车;

你也可以把它写成margin-left:auto; margin-right:auto;

但是第一个解决方案是代码少。如果是文本,你可以尝试text-align:center;

祝你好运。让我知道这是否适合你。