我正在尝试使用 cordova,但我忘记了过去关于 html 和 css 的大部分知识...但我想在容器内创建一个简单的 3 div 布局,每个布局的高度为 33%,宽度为 100%。这是我的 html:
<body>
<div class="container">
<div class="ctn1">
<h2>ddd</h2>
</div>
<div class="ctn2">
</div>
<div class="ctn3">
</div>
</div>
</div>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/index.js"></script>
</body>
和我的CSS:
body{
height: 100%;
min-height: 100%;
}
.container{
height:100%;
width:100%;
}
.ctn1{
min-height: 33%;
min-width: 100%;
background-color: red;
}
.ctn2{
min-height: 33%;
min-width: 100%;
background-color: yellow;
}
.ctn3{
min-height: 33%;
min-width: 100%;
background-color: blue;
}
背景只显示里面的文字...谢谢
最佳答案
在 CSS 中继承高度总是有点棘手。
您需要为 html
和 body
提供 100% 的高度并移除它们的默认边距。此外,确保默认的 h2
边距保留在其容器内,使您的容器 overflow: hidden
。
关于html - 最小高度最小宽度不适用于 Cordova ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32882034/