Is it possible to overlay an image and a text inside of an <img>
? To look something similar like the image below. I'm using Bootstrap
this is how I'm trying to do it:
<div class="form-group">
<img id="uploadPreview" class="photo-style">
</div>
<div class="form-group">
<input type="file" capture="camera" accept="image/*" id="id_photo"
name="photo" onchange="PreviewImage();">
</div>
.photo-style{
display: block;
width: 100%;
height: 325px;
background: lightyellow url(../img/internet-world.png);
margin-left: auto;
margin-right: auto !important;
border-radius: 4px;
}
您可以只使用ap标记包含文本的div,然后使用CSS定位文本并为div设置正确的高度/宽度,然后在div上应用背景图像?
use position
property of css
.parent{
position:relative;
}
.child{
position:absolute;
left:50%;
top:50%
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.