【发布时间】:2017-01-25 22:25:52
【问题描述】:
我在尝试垂直对齐 div 时有点吃力。我的目标是拥有 3 个高度为 100% 和宽度为 33% 的 div 以拥有居中的内容 div。任何人都可以帮忙吗?代码如下:
.wrapper {
height: 100%;
width: 100%;
}
.window {
width: 33%;
float: left;
background-color: #666;
}
.windowContent {
background-color: #000;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<div class="wrapper">
<div class="window">
<div class="windowContent">
</div>
</div>
<div class="window">
<div class="windowContent">
</div>
</div>
<div class="window">
<div class="windowContent">
</div>
</div>
</div>
</body>
</html>
【问题讨论】:
-
问题是我想要100%的高度,而不是设定值