破碎的HTML表格

时间:2017-05-30 16:31:33

标签: html css twitter-bootstrap

我有以下样式和HTML,但是当它显示时,表格显示为已损坏(所有表格行和单元格都已损坏)。我不确定为什么;我该如何解决?

compinit
tbody {
  display: block;
  overflow-y: scroll;
  height: calc(100% - 130px);
}

tbody > tr {
  display: table;
  width: 100%;
}

2 个答案:

答案 0 :(得分:1)

CSS:

删除tbody和tr中的display属性

tbody {
   //display:block;
    overflow-y: scroll;
    height: calc(100% - 130px);
}

tbody > tr {
  //display: table;
  width: 100%;
}

答案 1 :(得分:1)

问题是您的tbody设置了display: blocktrdisplay: table。你的CSS中的东西必须设置这个。您可以删除任何设置此内容或通过将以下内容添加到您的CSS来覆盖它。

tbody {
    display:block;
    overflow-y: scroll;
    height: calc(100% - 130px);
}

tbody {
  display: table-row-group;
}

tbody > tr {
  display: table-row;
  width: 100%;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="col-lg-8 ">
    <div class="col-lg-12">
      <table class="table table-striped" aurelia-table="">
        <thead>
            <th>test</th>
            <th>test</th>
            <th>test</th>
            <th>test</th>
            <th>test</th>
        </thead>
        <tbody>
          <tr class="" >
            <td>test</td>
            <td>test</td>
            <td>test</td>
            <td>
              <div class="form-group">
                <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                  <option value="" selected=""></option>
                  <option value="-action"> Action</option>
                </select>
              </div>
            </td>
            <td>
              <i class="fa fa-minus" aria-hidden="true" click.delegate=""></i>
            </td>
          </tr>
           <tr class="" >
            <td>test</td>
            <td>test</td>
            <td>test</td>
            <td>
              <div class="form-group">
                <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                  <option value="" selected=""></option>
                  <option value="-action"> Action</option>
                </select>
              </div>
            </td>
            <td>
              <i class="fa fa-minus" aria-hidden="true" click.delegate=""></i>
            </td>
          </tr>
           <tr class="" >
            <td>test</td>
            <td>test</td>
            <td>test</td>
            <td>
              <div class="form-group">
                <select id="selectbasic" name="selectbasic" class="form-control col-lg-6 col-md-6 col-sm-6">
                  <option value="" selected=""></option>
                  <option value="-action"> Action</option>
                </select>
              </div>
            </td>
            <td>
              <i class="fa fa-minus" aria-hidden="true" click.delegate=""></i>
            </td>
          </tr>
        </tbody>
      </table>
      <!--  textarea -->
      <div class="form-group">
        <label class="col-md-12 control-label" for="textarea"></label>
        <div class="row">
          <div class="col-md-12">
            <compose view="./-box.html"></compose>
          </div>
        </div>
      </div>
    </div>
  </div>