我有一個div和它裏面的圖片作爲背景:CSS定位的麻煩
<div id="background">
<img src="background.png" class="stretch" alt="" />
<div class="header">
<span>header</span>
</div>
<div class="picture">
<img src="pic" alt="" />
</div>
</div>
下面CSS:
#background {
width: 100%;
height: 100%;
position: absolute;
left: 0px;
top: 0px;
z-index: 0;
}
.stretch {
width:100%;
height:100%;
}
.header {
position: absolute;
left: 12px;
top: 18px;
font-family: Arial;
font-size: 14pt;
color: #3A4549;
margin-bottom:
}
這裏有一個小提琴:http://jsfiddle.net/3j7vk/
我怎麼能在標題下面添加圖像而不指定絕對位置? 現在它在背景圖像下。謝謝!
你能製作一個[jsfiddle](http://jsfiddle.net)嗎?你可以使用[lorempixel](http://lorempixel.com)或[placekitten](http://placekitten.com)的圖片 – JKirchartz 2012-04-03 13:04:30
http://jsfiddle.net/3j7vk/ – scorpion 2012-04-03 13:10:23