gpt4 book ai didi

html - 将按钮放在不同尺寸的盒子中的相同位置

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

我正在使用图片库。每个图像都有不同的大小、砖石风格。如何在每个图像内的相同位置放置不同尺寸的按钮?我想把按钮放在右上角。

CSS

.EyeG{
cursor: pointer;
position: absolute;
background-color: white;
background-image: url("/assets/eye.svg");
background-position: 13px 13px;
background-repeat: no-repeat;
height: 15%;
width: 15%;
margin-top: -329px;
right: 13px;
border-radius: 8px;
opacity: 1;
}

HTML

<ngx-masonry [options]="masonryOptions" [useImagesLoaded]="true">
<ngxMasonryItem *ngFor="let p of products" class="masonry-item">
</div>
<img [src]="imagMap.get(p.id)">
<figcaption class="EyeG"></figcaption>
</ngxMasonryItem>
</ngx-masonry>

最佳答案

试试这个


.masonry-item { position: relative }
.EyeG{
cursor: pointer;
position: absolute;
background-color: white;
background-image: url("/assets/eye.svg");
background-position: 13px 13px;
background-repeat: no-repeat;
height: 15%;
width: 15%;
border-radius: 8px;
opacity: 1;
top:50%;
left:50%;
transfomrm: translate(-50%, -50%);

}

关于html - 将按钮放在不同尺寸的盒子中的相同位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58990807/

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