如何围绕glyphicon bootstrap创建方块?

时间:2016-08-31 03:48:25

标签: html css twitter-bootstrap

我想创建一个这样的图标:

http://i.stack.imgur.com/THnPN.png



<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
&#13;
&#13;
&#13;

如何围绕此图标绘制正方形?感谢。

更新:似乎添加CSS我的代码坏了。

你可以看到它:

一切都不正确。

更新的代码:

&#13;
&#13;
span.glyphicon {
    background-color: #eee;
    border: 1px solid #000;
    border-radius: 8px;
    height: 50px !important;
    padding-top: 17px;
    text-align: center;
    width: 50px !important;
}
&#13;
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
  <div class="panel panel-primary">
    <div class="panel-heading active" role="tab" id="headingOne">
      <h4 class="panel-title">
        <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseThree">
          Example <span class="glyphicon glyphicon-plus pull-right" aria-hidden="true"></span>
        </a>
      </h4>
    </div>
    <div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne" aria-expanded="true">
      <div class="panel-body">
        <div class="list-group">

          <form accept-charset="UTF-8" action="" method="post">

            <select name="select_baogia" class="select_baogia">
              <option value="">Tree 1</option>
              <option value="">Tree 2</option>
              option
            </select>
            <input  name="name" placeholder="Name" type="text"> 
            <input  name="email" placeholder="Email" type="text">
            <input class="text_baogia"  name="phone" placeholder="Phone num" type="text"> 
            <input name="diadiem" placeholder="Location" type="text"> 
            <button class="btn btn-warning" type="submit">Call back to me</button>
          </form>


        </div>
      </div>
    </div>
  </div>
&#13;
&#13;
&#13;

2 个答案:

答案 0 :(得分:3)

  1. 您可以使用CSS:
  2. &#13;
    &#13;
    span.glyphicon.glyphicon-plus {
      background-color: #eee;
      border: 1px solid #000;
      border-radius: 8px;
      height: 50px !important;
      padding-top: 17px;
      text-align: center;
      width: 50px !important;
    }
    &#13;
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
    
    <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
    &#13;
    &#13;
    &#13;

    1. 你可以按一下按钮:
    2. &#13;
      &#13;
      <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
      
      <a class="btn btn-default" href="#" role="button"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></a> or 
      <button class="btn btn-default" type="submit"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span></button>
      &#13;
      &#13;
      &#13;

      查看文档:{​​{3}}

      <强>更新

      &#13;
      &#13;
      span.glyphicon.glyphicon-plus {
          background-color: #eee;
          border: 1px solid #888;
          border-radius: 8px;
          height: 30px !important;
          margin-top: -8px;
          padding-top: 6px;
          text-align: center;
          width: 30px !important;
      }
      &#13;
      <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
      <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
        <div class="panel panel-primary">
          <div class="panel-heading active" role="tab" id="headingOne">
            <h4 class="panel-title">
              <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseThree">
                Example <span class="glyphicon glyphicon-plus pull-right" aria-hidden="true"></span>
              </a>
            </h4>
          </div>
          <div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne" aria-expanded="true">
            <div class="panel-body">
              <div class="list-group">
                <form accept-charset="UTF-8" action="" method="post">
                  <select name="select_baogia" class="select_baogia">
                    <option value="">Tree 1</option>
                    <option value="">Tree 2</option>
                  </select>
                  <input  name="name" placeholder="Name" type="text"> 
                  <input  name="email" placeholder="Email" type="text">
                  <input class="text_baogia"  name="phone" placeholder="Phone num" type="text"> 
                  <input name="diadiem" placeholder="Location" type="text"> 
                  <button class="btn btn-warning" type="submit">Call back to me</button>
                </form>
              </div>
            </div>
          </div>
        </div>
      &#13;
      &#13;
      &#13;

      注意: CSS是一种非常简单的语言。您可以通过w3school学习:http://getbootstrap.com/css/#buttons

答案 1 :(得分:1)

你可以把它放在CSS中,这可以回答你的问题。

.glyphicon{
border:1px solid #000;
padding: 5px 10px;
}

修改

这是一个有效的小提琴

https://jsfiddle.net/px3h7kz9/