为什么百分比高度在我的div上不起作用

为什么百分比高度在我的div上不起作用,第1张

为什么百分比高度在我的div上不起作用

使用

vh
(视口高度)代替百分比。它将获取浏览器的高度并相应地调整其大小,例如

height:90vh;

试试这个代码

<!DOCTYPE html><html><head>  <meta charset="utf-8">  <title>JS Bin</title></head><body><div id ="wrapper">    <div id="tabs" ng-controller="TabsDataCtrl">        <tabset> <tab id="tab1" heading="{{tabs[0].title}}" ng-click="getContent(0)" active="tabs[0].active"    disabled="tabs[0].disabled"> </tab> <tab id="tab2" heading="{{tabs[2].title}}" ng-click="getContent(2)" active="tabs[2].active"      disabled="tabs[2].disabled"> </tab>        </tabset>    </div>    <div id="leaflet_map" ng-controller="iPortMapJobController">        <leaflet center="center" markers="markers" layers="layers"></leaflet>    </div>    </div></body></html>

与CSS

<style>    #wrapper{height:60vh;}    #tabs {width:20% float:left; height:60vh; overflow-y:scroll; overflow-x:hidden;}    #leaflet-map{width:78%; height:60vh; overflow-y:scroll;  overflow-x:hidden;}</style>


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/5017962.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-11-15
下一篇2022-11-14

发表评论

登录后才能评论

评论列表(0条)

    保存