【发布时间】:2015-11-05 16:45:01
【问题描述】:
我需要创建一个两列布局 (Online Example):
<header>
A<br/>
B<br/>
</header>
<main>
<div class="wrapper">
Vis iriure laboramus at. Quis audire ei vis ...
</div>
</main>
- 标题宽度必须固定;
- 主宽度必须是可变的 (%) 宽度是最大宽度(以像素为单位);
- 页眉和主高度必须为 100%。
我尝试了以下 CSS:
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
} // *
html, body {
height: 100%;
margin: 0;
padding: 0;
width: 100%;
}
body {
background-color: black;
overflow: hidden;
}
header {
background-color: red;
height: 100%;
width: 44px;
float: left;
}
main {
background-color: green;
height: 100%;
margin-right: -44px;
max-width: 400px;
width: 100%;
float: left;
}
.wrapper {
height: 100%;
margin-right: 88px;
padding: 24px;
}
但是,header 和 main 不是 100% 的高度。
有谁知道如何解决这个问题?
更新 1
Another Question的代码不起作用!
检查相同的代码,但文本更多: http://plnkr.co/edit/xM0BnHbF5Dh08EvrGY2V?p=preview
看看,文本是如何脱离包装的......
更新 2
我在左侧添加了一个菜单。
将鼠标悬停在项目“A”、“B”等上,看看它应该如何工作。
菜单运行良好......我不想打破它。
【问题讨论】:
标签: html css multiple-columns fluid-layout