我尝试了多种方法,但没有定位<img>
在所需的位置。它总是卡在两个跨度之间。试图从孩子中取出 imgdiv
并将其添加到父 div 中。但没有运气。我想将它定位在我的跨度下方并使用padding-top:20px;
.This 图像是 200x38px 图像。这是我的代码:
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%;
}