【发布时间】:2015-10-01 16:08:58
【问题描述】:
我正在尝试使用 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;
}
背景只显示里面的文字...谢谢
【问题讨论】:
-
因为 min-height 不能以百分比计算。用像素或 em 试试。