【发布时间】:2016-01-08 20:07:43
【问题描述】:
我正在尝试在图像上放置一个“通知”样式的徽章。我使用 Twitters Bootstrap 作为基础框架并创建了一个名为 notify-badge 的自定义 CSS 类。但我无法让任何东西正确排列。
通过 Photoshop 的魔力,这就是我想要完成的任务。 [![在此处输入图片描述][1]][1]
这是我的 CSS 代码。
.notify-badge{
position: absolute;
background: rgba(0,0,255,1);
height:2rem;
top:1rem;
right:1.5rem;
width:2rem;
text-align: center;
line-height: 2rem;;
font-size: 1rem;
border-radius: 50%;
color:white;
border:1px solid blue;
}
我希望能够在徽章中放置任何小的文字,它会扩大红色圆圈以适应。
这是我的 HTML 代码。
<div class="col-sm-4">
<a href="#">
<span class="notify-badge">NEW</span>
<img src="myimage.png" alt="" width="64" height="64">
</a>
<p>Some text</p>
</div>
【问题讨论】:
标签: html css twitter-bootstrap notifications