表高度:100%不会将表格扩展为父div的大小

时间:2016-02-13 20:57:54

标签: html css css3 flexbox

高度:100%似乎不适用于我的桌子。该表是div #r1,它是flex布局的一部分。 https://jsfiddle.net/danielyaa5/6c3ujp1p/4/

HTML

 <section class="analysis">
  <div class="menubar">

    <div class="dropdown" id="file-btn">
      <button href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">File <span class="caret"></span></button>
      <ul class="dropdown-menu">
        <li><a href="#">Action</a></li>
        <li><a href="#">Another action</a></li>
        <li><a href="#">Something else here</a></li>
        <li role="separator" class="divider"></li>
        <li><a href="#">Separated link</a></li>
        <li role="separator" class="divider"></li>
        <li><a href="#">One more separated link</a></li>
      </ul>
    </div>

    <div id="view-ctrls-cntnr">
      <div class="btn-group" role="group">
        <button class="btn btn-default" ng-class="{'active-view': active_views[0]}" ng-click="toggleView(0)">R-Theta</button>
        <button class="btn btn-default" ng-class="{'active-view': active_views[1]}" ng-click="toggleView(1)">Cartesian</button>
        <button class="btn btn-default" ng-class="{'active-view': active_views[2]}" ng-click="toggleView(2)">Longitudinal</button>
        <button class="btn btn-default" ng-class="{'active-view': active_views[3]}" ng-click="">Console</button>
      </div>
    </div>
  </div>
  <div id="views-cntnr">
    <div id="r1" class="view-row">
      <table>
        <tr>
          <td id="v1" class="view">View 1</td>

          <td id="v2" class="view">View 2</td>
        </tr>
      </table>
    </div>
    <div id="r2" class="view-row">
      <div id="v4" class="view">V4</div>
    </div>
  </div>
  <div id="footer-ctrl-cntnr">
    <div id="frame-num" class="frame-ctrl"># X</div>
    <div id="frame-range-cntnr" class="frame-ctrl">
      <input type="range">
    </div>
    <div id="footer-btns-cntnr">
      <button id="console-btn">Console</button>
      <button id="hotkey-btn" class="fa fa-keyboard-o"></button>
    </div>
  </div>
</section>

CSS

html,
body {
  height: 100%;
}

.analysis {
  display: flex;
  flex-direction: column;
  height: 100%;
}


/* MENUBAR */

.menubar {
  height: 35px;
  font-size: 12px;
  background-color: #eee;
  border: hsl(0, 0%, 75%) solid 1px;
  border-right: none;
  border-left: none;
  position: relative;
}


/* VIEWS-CTRLS-CNTNR */

#view-ctrls-cntnr {
  display: inline-block;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

#view-ctrls-cntnr button {
  font-size: inherit;
}


/*view-ctrls-cntnr */


/* FILE-BTN */

#file-btn {
  margin-left: 34px;
  display: inline-block;
  height: 100%;
}

#file-btn button {
  position: relative;
  line-height: 30px;
  color: black;
  background-color: transparent;
  border: none;
  z-index: 100;
}

#file-btn button:focus {
  background-color: white;
}

#file-btn:hover {
  background-color: rgba(0, 0, 0, 0.0392157);
}


/* FILE-DROPDOWN */

#file-btn .dropdown-menu {
  margin-top: -1px;
  z-index: 10;
  left: -34px;
  border-left: none;
  border-radius: 0;
}


/* file-btn */


/* menubar */


/* VIEWS */

#views-cntnr {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}


/* ROWS */


/* ROW 1 */

#r1 {
  flex-grow: 4;
}

#r1 table {
  width: 100%;
  height: 100%;
}

#r1 .view {
  border: 1px solid black;
  border-top: none;
}
#r1 .view:last-child {
  border-right: black 1px solid;
}


/* row 1 */


/* ROW 2 */

#r2 .view {
  border: black 1px solid;
  border-top: none;
  flex-grow: 1;
}

#r2 {
  display: flex;
  flex-grow: 1;
}


/* row 2 */


/* rows */


/* views */


/* FOOTER CTRL */

#footer-ctrl-cntnr {
  display: flex;
}

.frame-ctrl {
  border: black 1px solid;
  border-top: none;
  border-right: none;
}

.frame-ctrl:last-child {
  border-right: black 1px solid;
}

#frame-num {
  width: 50px;
}

#frame-range-cntnr {
  flex-grow: 1;
  padding: 4px;
}


/* FOOTER BTNS */

#footer-btns-cntnr {
  border-left: black 1px solid;
  padding-right: 4px;
}

#footer-btns-cntnr button {
  margin: 2px;
}

#console-btn {
  font-size: 8px;
}


/* footer ctrl */

0 个答案:

没有答案