body {
width: 100%;
height: 100%;
margin: 0px;
padding: 0px;
}
header {
background-color: red;
height: 70px;
}
main {
background-color: green;
height: 30%;
}
footer {
background-color: blue;
}
#left_image {
background-image: (left.jpg);
height: 100%;
/* auto width for proper image scaling */
}
#right_image {
background-image: (right.jpg);
width: 50%;
/* auto height for proper image scaling */
}
#content {
width: 100%;
margin: 3em 1em;
z-index: 1;
}

<body>
<header></header>
<main>
<div id="left_image"></div>
<div id="right_image"></div>
<div id="content">This content is in front of the background-images</div>
</main>
<footer></footer>
</body>
&#13;
main
容器的左侧和右侧放置两个背景图像,main
的内容应居中(水平和垂直)并位于背景图像的前面。我该怎么做到最好?我尝试使用background-image
的容器。我真的必须使用三格容器吗?