我有一个网页,我希望所有元素都固定在原位,这样整个页面就没有滚动条。我有一个标题、一个左侧菜单和一个区域,该区域显示图形,直接在图形下方应该是一个列表。
标题和图形区域之间有一个间隙,我无法去掉它。我的外边距和内边距已经设置为0。
此外,绘图应占据标题下方空间的60%,列表占据40%,但两个元素都不正确,两个元素的垂直位置都明显高于页面底部。
标题和图形区域之间有一个间隙,我无法去掉它。我的外边距和内边距已经设置为0。
此外,绘图应占据标题下方空间的60%,列表占据40%,但两个元素都不正确,两个元素的垂直位置都明显高于页面底部。
html,
body {
margin: 0;
padding: 0;
}
.float {
width: 100%;
background-color: blue;
padding-top: 60px;
display: flex;
display: -webkit-flex;
}
.main_title {
width: 70%;
height: 60px;
display: flex;
display: -webkit-flex;
flex-wrap: nowrap;
flex-flow: column;
justify-content: center;
background-color: red;
}
.clock {
width: 30%;
height: 60px;
background-color: green;
}
.header {
display: -webkit-flex;
display: flex;
height: 60px;
position: fixed;
width: 100%;
background-color: red;
margin: 0;
}
.menu {
width: 130px;
flex: 0 0 130px;
background-color: yellow;
height: 100%;
position: fixed;
}
.column_main {
flex: 1;
background-color: purple;
padding-left: 130px;
float: right;
}
.plot-wrapper {
width: 100%;
background-color: brown;
height: 60%;
}
#list {
background-color: lightblue;
width: 100%;
height: 40%;
position: fixed;
}
<body>
<div class="header">
<div class="header">
<div class="main_title">title</div>
<div class="clock">time</div>
</div>
</div>
<div class="float">
<nav class="menu">
<p>menu</p>
</nav>
<div class="column_main">
<div class="plot-wrapper">
<p>plot wrapper</p>
</div>
<div id="list">
<p>list</p>
</div>
</div>
</div>
</body>
plot-wrapper
中,您需要设置p {display: block; -webkit-margin-before: 1em; -webkit-margin-after: 1em; -webkit-margin-start: 0px; -webkit-margin-end: 0px;}
的margin: 0
。 - onetwo12.float
没有设置高度,因此.plot-wrapper
的height: 60%
不起作用。 - abhishekkannojia