html围绕文本圈

时间:2014-06-24 05:51:33

标签: html html5 twitter-bootstrap-3

是否有CSS方法在文本周围创建圆圈。我的文字只是一个“+”符号,我试图围绕它创建一个圆圈。我试过了自举徽章,但那是椭圆形的。

有什么想法吗?

感谢。

3 个答案:

答案 0 :(得分:2)

以下是fiddle

<span>+</span>

span {
    display: block;
    height: 30px;
    width: 30px;
    line-height: 30px;

    -moz-border-radius: 30px;
    border-radius: 30px;

    background-color: grey;
    color: white;
    text-align: center;
    font-size: 2em;
}

答案 1 :(得分:0)

试试这个

HTML

<label>+</label>

CSS

label{
    padding: 4px 9px; 
    background: #dddddd;
    width: 1px;
    border-radius: 45%;
}

http://jsfiddle.net/XBc2M/

根据需要调整填充

答案 2 :(得分:0)

以下是我们在其中一个应用中所做的,希望它有所帮助。

enter image description here

.circle {
   display: inline-block;
   width: 20px;
   height: 20px;
   border-radius: 50%;
   color: white;
   background-color: red;
   text-align: center;
   font-weight: bold;
   vertical-align: middle;
   line-height: 20px;
 }

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

这是Codepen:http://codepen.io/SaraChicaD/pen/zKYaoO