Pav*_*dek 47 html javascript css height
我有一个div,height: 100%;但它不起作用.当我宣布一个固定的高度(例如height: 600px;)它正在工作,但我想要一个响应式设计.
HTML:
<blink><div class="row-fluid split-pane fixed-left" style="position: relative; height: 78%;">
<div class="split-pane-component" style="position: relative; width: 50em;">
<div style="">
<ul class="nav nav-tabs">
<li class="active"><a href="#html" data-toggle="tab">Html</a></li>
<li><a href="#helpers" data-toggle="tab">Helpers</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="html" style="height: 100%;">
<textarea id="htmlArea" style="height: 100%;">{{:html}}</textarea>
</div>
<div class="tab-pane" id="helpers" style="height: 100%;">
<textarea id="helpersArea">{{:helpers}}</textarea>
</div>
</div>
</div>
</div>
<div class="split-pane-divider" id="my-divider" style="left: 50em; width: 5px;"></div>
<div class="split-pane-component" style="left: 50em; margin-left: 5px;">
<div style="">
<ul class="nav nav-tabs">
<li>
<a href="#" class="active">Preview
<img width="22px" height="16px" class="preview-loader" src="img/spinner-green2.gif" style="display: none" />
</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active" style="height: 100%;">
<iframe name="previewFrame" frameborder="0" allowtransparency="true" allowfullscreen="true" style="width: 100%; height: 100%;"></iframe>
</div>
</div>
</div>
</div>
</div>
</blink>
Run Code Online (Sandbox Code Playgroud)
Nig*_*ght 39
您可能需要声明下面的代码height:100%才能为您的div工作
html, body {margin:0;padding:0;height:100%;}
Run Code Online (Sandbox Code Playgroud)
小智 23
您没有指定html的"高度".当您在元素中指定百分比(即div)时,css编译器需要知道父元素的大小.如果你没有指定它,你应该看到没有高度的div.
最常见的解决方案是在css中设置以下属性:
html{
height: 100%;
margin: 0;
padding: 0;
}
Run Code Online (Sandbox Code Playgroud)
你是对html标签说的(html是所有html元素的父级)"取HTML文档中的所有高度"
我希望我帮助过你.干杯
将包含元素/div 设置为高度。否则,您要求浏览器将高度设置为未知值的 100%,但它不能。
更多信息在这里: http://webdesign.about.com/od/csstutorials/f/set-css-height-100-percent.htm
| 归档时间: |
|
| 查看次数: |
127944 次 |
| 最近记录: |