gpt4 book ai didi

html - 在图像上放置背景图像

转载 作者:太空宇宙 更新时间:2023-11-03 21:53:42 25 4
gpt4 key购买 nike

我正在尝试将背景图像放在图像上。

基本上它显示“用户”是否批准或拒绝了某事。

如果获得批准,我希望在用户显示的图像上显示一个绿色勾号。

我尝试创建它,但我所拥有的不起作用。

这是我目前所拥有的:

HTML

<img class="small-profile-img accepted" src="http://www.image.com/image.gif" alt="">

CSS

.small-profile-img{
width:30px;
display:inline;
border:2px solid #000000;
}

.accepted{
background-image:url("tick.png") !important;
background-repeat:no-repeat;
background-position:right bottom;
z-index:100;
background-size:18px;
}

有关工作示例,请参阅 jsfiddle。

jsfiddle

最佳答案

解决方案是对 accepted 类使用带有 after 伪元素的包装器:

.accepted:after {
content: '';
display: block;
height: 18px;
width: 18px;
position: absolute;
bottom: 0;
right: 0;
background-image:url("http://cdn1.iconfinder.com/data/icons/checkout-icons/32x32/tick.png");
background-repeat: no-repeat;
background-position: right bottom;
z-index: 100;
background-size: 18px;
}

HTML

<div class="small-profile-img accepted">
<img src="http://2.bp.blogspot.com/-KLcHPORC4do/TbJCkjjkiBI/AAAAAAAAACw/zDnMSWC_R0M/s1600/facebook-no-image1.gif" alt="">
</div>

http://jsfiddle.net/vpgjr/7/

关于html - 在图像上放置背景图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15429984/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com