高度问题出现,而我使ul列表类似视觉像表

时间:2016-01-08 05:44:34

标签: css html5 css3

我有一套ul列表。这些列表看起来像我需要的2列表。我做到了。但是当任何列表内容增加时会出现问题。问题是相同的高度未应用。所以它看起来很破旧。

此处我的Fiddle及以下是代码段



    ul.filter_list {
      margin: 0px;
      padding: 0px;
      width: 100%;
      display: table;
      border: 1px #000 solid;
    }
    li.filter_cell {
      display: table-cell;
      width: 50%;
      float: left;
      padding: 4px;
      border-collapse: collapse;
      border-top: 1px #000 solid;
      box-sizing: border-box;
    }
    ul.filter_list li:nth-child(odd) {
      border-right: 1px #000 solid;
    }
    .filtertab_title {
      font-family: 'open_sansbold';
      margin-top: 8px;
      margin-bottom: 5px;
      margin-left: 16px
    }
    .filtertab_value {
      margin-bottom: 10px;
      margin-left: 16px
    }

<ul class="filter_list">
  <li class="filter_cell">
    <div class="filtertab_title">PMT Base Name</div>
    <div class="filtertab_value">
      <select class="filtertab_select">
        <option>Any</option>
      </select>
    </div>
  </li>
  <li class="filter_cell">
    <div class="filtertab_title">Category</div>
    <div class="filtertab_value">
      <select class="filtertab_select">
        <option>Any</option>
      </select>
    </div>
  </li>
  <li class="filter_cell">
    <div class="filtertab_title">Pattern Category Name and documentation information for lorem text goes here dummy text</div>
    <div class="filtertab_value">
      <select class="filtertab_select">
        <option>Any</option>
      </select>
    </div>
  </li>
  <li class="filter_cell">
    <div class="filtertab_title">GMT Base Name</div>
    <div class="filtertab_value">
      <select class="filtertab_select">
        <option>Any</option>
      </select>
    </div>
  </li>
  <li class="filter_cell">
    <div class="filtertab_title">Measurement</div>
    <div class="filtertab_value">
      <select class="filtertab_select">
        <option>Any</option>
      </select>
    </div>
  </li>
  <li class="filter_cell">
    <div class="filtertab_title">Base Name</div>
    <div class="filtertab_value">
      <select class="filtertab_select">
        <option>Any</option>
      </select>
    </div>
  </li>

</ul>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

更改结构

<div class="filter_divst">
<div class="filter-row"> <!--add this element to create a row for 2 columns-->
    <div class="filter_cell">
      <div class="filtertab_title">PMT Base Name</div>
      <div class="filtertab_value">
        <select class="filtertab_select">
          <option>Any</option>
        </select>
      </div>
    </div>
    <div class="filter_cell">
      <div class="filtertab_title">Category</div>
      <div class="filtertab_value">
        <select class="filtertab_select">
          <option>Any</option>
        </select>
      </div>
    </div>
  </div>
<div class="filter-row"> <!--add this element to create a row for 2 columns-->
    <div class="filter_cell">
      <div class="filtertab_title">Pattern Category Name and documentation information for lorem text goes here dummy text</div>
      <div class="filtertab_value">
        <select class="filtertab_select">
          <option>Any</option>
        </select>
      </div>
    </div>
    <div class="filter_cell">
      <div class="filtertab_title">GMT Base Name</div>
      <div class="filtertab_value">
        <select class="filtertab_select">
          <option>Any</option>
        </select>
      </div>
    </div>
</div>
<div class="filter-row"> <!--add this element to create a row for 2 columns-->
    <div class="filter_cell">
      <div class="filtertab_title">Measurement</div>
      <div class="filtertab_value">
        <select class="filtertab_select">
          <option>Any</option>
        </select>
      </div>
    </div>
  <div class="filter_cell">
    <div class="filtertab_title">Base Name</div>
    <div class="filtertab_value">
      <select class="filtertab_select">
        <option>Any</option>
      </select>
    </div>
  </div>
</div>
</div>



div.filter_list
{
    margin:0px; 
  padding:0px; 
  width:100%;
  border:1px #000 solid;/*add this */
}
.filter-row{ /*add this */
  width:100%;
  display:flex;
  -webkit-display:flex;
}
div.filter_cell
{
  width:50%; 
  padding:4px; 
  box-sizing:border-box;/*add this */
  border-collapse:collapse; 
  border-top:1px #000 solid;
  box-sizing:border-box;
  border-left: 1px #000 solid;
}