真棒

2016-03-05 64 views
0

堆积glyphicons与字体我有fa-circle-thin中,我要放置glyphicon,所以它看起来像有在我glyphicon圆边框。我只想知道这是否可能?真棒

我尝试以下操作:

 <div class="col-md-4"> 
      <span class="circle"> 
       <i class="glyphicon glyphicon-star"></i> 
      </span> 
      <h4 class="service-heading">Lorem</h4> 
      <p class="text-muted">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minima maxime quam architecto quo inventore harum ex magni, dicta impedit.</p> 
     </div> 

但是这两个图标并排显示出来的一面。我为我的FA做了一个类,看起来像这样:

.circle:before { 
    font-family: fontawesome-webfont; 
    text-decoration: none; 
    content: "\f1db"; 
    background-color: transparent; 
    z-index:-1; 
} 
+0

能为您提供的jsfiddle/codepen? – Bjorn

+0

https://jsfiddle.net/u4gdtmbp/2/ –

回答

1

我只是用border-radius: 50%,而不是试图定位两个字形(再加上你可以风格的边界!)。我也定心事情text-align: center并通过匹配line-heightheight值:

.circle { 
 
    border: 1px solid black; 
 
    border-radius: 50%; 
 
    padding: 3px; 
 
    width: 25px; 
 
    height: 25px; 
 
    display: inline-block; 
 
    text-align: center; 
 
    line-height: 25px; 
 
} 
 

 
.alt { 
 
    border-width: 2px; 
 
    border-color: red; 
 
    color: red; 
 
    width: 15px; 
 
    height: 15px; 
 
    line-height: 15px; 
 
}
<div class="circle"> 
 
    
 
</div> 
 

 
<div class="circle alt"> 
 
    
 
</div>

+0

我试过,但在我看来它看起来非常像素 –

+0

我怎么会得到明星正好在边界的中间? –

+0

这呈现为以Windows为中心,但至少在OS X中偏离中心...这很可能是操作系统之间字体实现的问题。 –

0

如何使用posiiton:absolute?

.glyphicon{ 
    position: absolute; 
    top: 3px; 
    left: 15px; 
} 

结果:jsfiddle

+0

它可能,但我不得不捣鼓我的右路 –