李在中心的文字?

时间:2016-11-03 10:35:14

标签: html css

ul获得了li,我想让li更小,我用height:30px做了,但现在文字不在li的中间:

enter image description here

如何解决?

  .properties_list .property_item
    {
        display:inline-block;
        font-size:15px;
    }
    .properties_list
    {
        font-family: Verdana, Arial, Helvetica, sans-serif;
        height: 30px;
        text-align: left;
    }
    .property_item
    {
        margin-right: 3px;
        height:30px;
    }
 <ul class="list-group properties_list treemenu">
    <li class="btn btn-active property_item list-group-item tree-empty">Property1</li>
    <li class="btn btn-active property_item list-group-item tree-empty">Property2</li>
    <li class="btn btn-active property_item list-group-item tree-empty">Property3</li><li class="btn btn-active property_item list-group-item tree-empty">Property4</li><li class="btn btn-active property_item list-group-item tree-empty">Property5</li><li class="btn btn-active property_item list-group-item tree-empty">Property6</li><li class="btn btn-active property_item list-group-item tree-empty">Property7</li><li class="btn btn-active property_item list-group-item tree-empty">Property8</li></ul>

1 个答案:

答案 0 :(得分:1)

line-height: 30px;课程中添加.property_item以获取

&#13;
&#13;
.properties_list .property_item {
    display: inline-block;
    font-size: 15px;
}
.properties_list {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    height: 30px;
    text-align: left;
}
.property_item {
    margin-right: 3px;
    height: 30px;
    line-height: 30px;
    border: 1px solid;
    width: 100px;
    text-align: center;
}
&#13;
<ul class="list-group properties_list treemenu">
  <li class="btn btn-active property_item list-group-item tree-empty">Property1</li>
  <li class="btn btn-active property_item list-group-item tree-empty">Property2</li>
  <li class="btn btn-active property_item list-group-item tree-empty">Property3</li>
  <li class="btn btn-active property_item list-group-item tree-empty">Property4</li>
  <li class="btn btn-active property_item list-group-item tree-empty">Property5</li>
  <li class="btn btn-active property_item list-group-item tree-empty">Property6</li>
  <li class="btn btn-active property_item list-group-item tree-empty">Property7</li>
  <li class="btn btn-active property_item list-group-item tree-empty">Property8</li>
</ul>
&#13;
&#13;
&#13;