我已經嘗試了多種東西,但沒有在所需的位置放置<img>
。它總是卡在兩個跨度之間。試圖img從孩子div
img並將其添加到父div。但沒有運氣。我想把它放在我的跨度之下,並且與padding-top:20px;
。這張圖片是一張200x38px的圖片。這裏是我的代碼:定位<img>元素
HTML
<div class="col1-step2">
<div class="heading-step2">
<span class="heading-step2">Hello signed User.</span>
<span class="heading-step2 textblue">How are you doing.</span>
<img class="user-bar" src="<?php echo site_url('img/bar.png'); ?>">
</div>
</div>
CSS
.col1-step2 {
float: left;
width: 40%;
height: 100%;
background-color: rgba(0, 0, 0, 0.8);
}
div.heading-step2 {
top: 6%;
position: relative;
}
.heading-step2 {
font-size: 24px;
color: #f7f7f7;
}
.heading-step2 .textblue {
color: #55c7fa;
font-weight: bold;
display: block;
}
img.user-bar {
position: absolute;
padding-top: 25%;
}
想要的定位是什麼? – Sharlike 2013-03-25 20:28:07
要放置它的位置 – 2013-03-25 20:28:53
編輯我的問題。我希望它下面的跨度與20px的填充。 – 2013-03-25 20:33:06