【发布时间】:2019-10-02 17:43:16
【问题描述】:
我对 css 布局有一些问题。
我写了如下代码:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
</head>
<style>
html { height:100%; margin: 0px; padding: 0px; }
body {
height: 100%;
padding: 0px;
margin: 0px;
font-family: Verdana, helvetica, arial, sans-serif;
font-size: 68.75%;
background: #fff;
color: #333;
}
#header {
position: absolute;
width:100%;
background: #c0c0c0;
height: 100px;
}
#wrapper {
height: 100%;
width: 100%;
}
#content {
position: relative;
margin-left: 370px;
background: #ffdab9;
height: 100%;
}
#sidebar {
position: absolute;
background: #eee8aa;
width: 370px;
height: 100%;
}
</style>
<body>
<div id="header">header</div>
<div id="wrapper">
<div id="sidebar">sidebar</div>
<div id="content">content</div>
</div>
</body>
</html>
那么,我想做的事情就是
- “标题”的高度为 100 像素。
- “侧边栏(左侧)”的宽度 id 为 370 像素。
- “内容(右侧)”的宽度是相对的。
- 当我控制浏览器变小时,我不希望浏览器制作“滚动条”。
喜欢http://maps.google.com。谷歌地图在任何调整浏览器大小时都不会制作滚动条。
num.4 是我说过的最重要的。
如果目标达成,我的代码可以全部修复。请给我任何帮助。
【问题讨论】:
标签: css header height css-position