这是一个没有图像的基本结构,只有 bkg 颜色:
http://jsfiddle.net/dtYKL/
HTML:
<div class="theatre">
<div class="content">
<div class="curtain left">left curtain</div>
<div class="stage">stage!</div>
<div class="curtain right">right curtain</div>
</div>
</div>
CSS:
body, html{
margin:0;
width:100%;
height:100%;
}
.theatre{
width:100%;
background:#369; /* this is where you'd add your repeating curtain bkg */
}
.theatre .content{ /* this is your fixed-width stage content */
position:relative;
width:600px;
height:400px;
margin: 30px auto; /* centers the content */
}
.content .curtain{ /* set your common styles, dimensions, positions for left + right curtains */
position:absolute;
width:100px;
height:100%;
text-align:center;
}
.content .left.curtain{ /* position and add image for left curtain */
left:0;
top:0;
background:#963; /* this is where you'd add your left curtain image */
}
.content .right.curtain{ /* position and add image for right curtain */
right:0;
top:0;
background:#963; /* this is where you'd add your right curtain image */
}
.content .stage{
width:100%;
height:100%;
border-bottom:5px solid #000000; /* this will simulate a stage floor, you can use a solid bkg image if you want */
box-sizing:border-box; /* this is so the border added above won't add to the div height */
background-color:#888888; /* this is the stage background */
text-align:center;
}
我将所有的内容都嵌套在一个 .theatre 类的 div 中,这样你就可以为你的作品指定一个设定的高度。如果这不是必需的,请随意移除该级别的收容并仅使用“身体”作为重复背景幕。如果您有任何问题,请让我知道,祝您好运!:)