Css 在图标上添加文本
我希望文本以字形图标为中心。我尝试了一些css标签,但没有成功Css 在图标上添加文本,css,html,styling,glyphicons,Css,Html,Styling,Glyphicons,我希望文本以字形图标为中心。我尝试了一些css标签,但没有成功 <table> <tr> <td rowspan="4"> <span class="glyphicon glyphicon-bookmark"></span> <span>2</span> </td> <td>John
<table>
<tr>
<td rowspan="4">
<span class="glyphicon glyphicon-bookmark"></span>
<span>2</span>
</td>
<td>John Oliver</td>
</tr>
</table>
2.
约翰·奥利弗
您可以这样尝试:
.glyphicon {
position: relative;
}
.glyphicon + span {
position: absolute;
left: 5px;
top:5px; /* adjust the top & left values according to your need */
}
希望这就是你想要的 很抱歉最后的回答。我想这就是你想要的。看看演示 演示 HTML
<div class="container">
<i class="glyphicon glyphicon-heart icon-size"></i>
<span class="badge shoppingBadge shoppingBadge-custom">5</span>
</div>
你能分享你的css吗?glyphicon上的
是什么意思?2
?预期输出是什么。。你能显示为图像表示吗?添加了预期输出的图片。恐怕这不是我想要的。我附上了一张我想要的照片这不是我想要的Rajan。我已附上一张图片。无需将组件包装在容器中,否则在调整屏幕大小时,徽章将改变其位置,以下是一项改进:
.icon-size {
font-size:60px;
}
.shoppingBadge-custom{
background: red;
position:absolute;
left:47px;
top:18px;
font-size:14px;
z-index: 3;
}