CSS div高度不调整

时间:2016-04-07 15:25:47

标签: css twitter-bootstrap

我想在页面中显示100%的高度div: https://jsfiddle.net/pkggv96j/

<div id="page-content-wrapper">
    <div class="container-fluid">
        <div class="row">
            <div class="col-md-7 mapContainer">
                <div class="GISMap" v-el:map>test</div>
            </div>
            <div class="col-md-5 incidentContainer">
                <div class="incidentForm">test</div>
            </div>
        </div>
    </div>
</div>

// --Page Content
#page-content-wrapper {
  position: relative;
  height: 100%;
  padding: 0px;
}

.row .mapContainer {
  padding: 0px;
  height: 100%;
  background-color: red;
}

.GISMap {
  height: 100%;
  background-color: lightblue;
}

.incidentForm {
  height: 100%;
  width: 100%;
  background-color: lightgray;
}

.row .incidentContainer {
  padding: 0px;
  height: 100%;
}

但是row只有20pt的高度,并且不能扩展到100%。我是否错过了设置高度为100%的包含元素?

1 个答案:

答案 0 :(得分:1)

这是你想要的吗?

&#13;
&#13;
html, body {
  height: 100%;
  margin: 0;
}

#page-content-wrapper {
  height: 100%;
  padding: 0px;
  background-color: red;
}

.row, .container-fluid {
  height: 100%;
}

.row .mapContainer {
  padding: 0px;
  height: 100%;
  background-color: red;
}

.GISMap {
  height: 100%;
  background-color: lightblue;
}

.incidentForm {
  height: 100%;
  width: 100%;
  background-color: lightgray;
}

.row .incidentContainer {
  padding: 0px;
  height: 100%;
}
&#13;
<div id="page-content-wrapper">
    <div class="container-fluid">
        <div class="row">
            <div class="col-md-7 mapContainer">
                <div class="GISMap" v-el:map>test</div>
            </div>
            <div class="col-md-5 incidentContainer">
                <div class="incidentForm">test</div>
            </div>
        </div>
    </div>
</div>
&#13;
&#13;
&#13;