【发布时间】:2014-07-07 16:40:19
【问题描述】:
我需要将我的第二张图片 (img id="stack") 放在我的第一张图片之上。我尝试过使用相对定位和绝对定位,但它似乎在彼此下方。
HTML
<div id="imgpos">
<img id="bkgr" src="http://upload.wikimedia.org/wikipedia/commons /f/fd/Moon_in_Sunrise_Sky_2.jpg" width="400" height="400">
<img id= "stack" src="http://upload.wikimedia.org/wikipedia/commons/1/16/Appearance_of_sky_for_weather_forecast%2C_Dhaka%2C_Bangladesh.JPG" width="200" height="150">
</div>
CSS
#imgpos
{
position: relative;
left: 30px;
}
#imgpos bkgr
{
position: absolute;
z-index: 1;
}
#imgpos stack
{
position: absolute;
z-index: 2;
}
【问题讨论】:
标签: html css image positioning