2015-09-07 61 views
1

我希望文本以图形为中心。我试过几个CSS标签,但vain.Following是我的html在图形上添加文本

<table> 
    <tr> 
     <td rowspan="4"> 
      <span class="glyphicon glyphicon-bookmark"></span> 
      <span>2</span> 
     </td> 
     <td>John Oliver</td> 
    </tr> 
</table> 

enter image description here

+0

你可以分享你的CSS,请 –

+0

什么意思'上glyphicon'? '2'? –

+0

预期的输出是什么..你可以显示图像表示? –

回答

4

对不起。我认为这是你想要的。有看演示。

演示http://jsfiddle.net/yhq3npxs/

HTML

<div class="container"> 
    <i class="glyphicon glyphicon-heart icon-size"></i> 
    <span class="badge shoppingBadge shoppingBadge-custom">5</span> 
</div> 

CSS

.icon-size { 
font-size:60px; 
} 

.shoppingBadge-custom{ 
background: red; 
position:absolute; 
left:47px; 
top:18px; 
font-size:14px; 
z-index: 3; 
} 
+1

这不是我想要的Rajan。我已附上一张图片 –

+2

有外观更新的答案。 http://jsfiddle.net/yhq3npxs/ – 2015-09-08 08:47:30

+0

谢谢!这个作品 –

3

你可以尝试这样的:Demo

.glyphicon { 
    position: relative;  
} 

.glyphicon + span { 
    position: absolute; 
    left: 5px; 
    top:5px; /* adjust the top & left values according to your need */  
} 

希望这是你想要的!

+0

恐怕这不是我想要的。我附上了我想要的图像 –