【发布时间】:2016-07-28 21:12:54
【问题描述】:
这是我想做的:
我希望我已经用图片很好地解释了它。 我在这个主题上搜索了很多,但我真的不想进入大量的功能。我想尽可能简单地解决它。
问题在于,如果用户更改浏览器大小或在不同屏幕上显示,我希望所有人都能实时响应。
另外,关于在左侧菜单中添加这些图像;它们是 1:1 的边比,但我想将它们缩放在一起,它们将是左侧菜单的 100% 高度(图片中的蓝色)。
这是我目前所拥有的:
HTML/CSS:
header {
background-color: red;
position: relative;
width: 100%;
}
#allContents {
position: relative; /*minus širina headerja in footerja!!*/
height: 100%;
width: 100%;
float: left;
clear: both;
z-index: 10;
}
#leftMenu {
position: relative;
background-color: green;
width: 10%;
height: 100%;
z-index:10;
}
#mainContent {
background-color: yellow;
size: 20%;
float: left;
position: relative;
}
#rightMenu {
background-color: orange;
float: left;
position: relative;
top: 0;
right: 0;
width: 25%;
}
footer {
clear: both;
background-color: blue;
position: fixed;
bottom: 0px;
width: 100%;
}
<header>
Fixed. Some header content... also image on the left.
</header>
<div id="allContents">
<div id="leftMenu">On left, between header and footer, but never behind. Always between.</div>
<div id="mainContent">Between all 4 elements. Here will be main content with scrolling.</div>
<div id="rightMenu">Div with some news.</div>
</div>
<footer>
Fixed footer.
</footer>
【问题讨论】: