【发布时间】:2017-12-05 02:51:59
【问题描述】:
..以及如何将父/弹性框放在标题下方?如果header改变了高度,把下面的parent往下推?
我使用的是固定位置,因为除非我设置固定位置或绝对位置,否则我无法获得弹性框显示,但我正在使网站具有响应性,因此我无法放置绝对位置。
HTML
<div id="header"></div>
<div class="parent">
<div id="child1-aside"></div>
<div id="child2"></div>
</div>
<div id="bottom"></div>
CSS
#header {
position: fixed;
display: flex;
flex-wrap: wrap;
background-color: #343434;
top: 0;
right: 0;
left: 0;
height: auto; }
/* 下面是接管整个浏览器的高度/宽度而不是父级的,我需要它保持在页眉和页脚之间,并根据页眉和页脚的高度保持相对。 */
.parent {
position: fixed;
display: flex;
background-color: orange;
border: 3px solid blue;
height: 100%;
width: 100%;
}
#child1-aside {
position: fixed;
display: flex;
flex-wrap: wrap;
background-color: #2052a3;
border-right: 1px solid white;
left: 0%;
width: 9.5%;
height: 100%;
}
#child2 {
display: flex;
flex-wrap: wrap;
width: 100%;
height: 100%;
background-image: url(IMAGE.jpg);
background-repeat: no-repeat;
background-size: cover;
background-position: center center;
}
【问题讨论】:
标签: html css flexbox css-position