gpt4 book ai didi

angularjs - 无法将图像放在中心

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

每次单击按钮时,图像都会不断变化。现在的问题是我需要使图像居中,这样无论图像是小还是大,它都位于中心,并且我已经根据高度和宽度使图像响应。

enter image description here目前这是在中心顶部,我需要它在中间。

<section class="col col-2">
<div class="imagewh">
<center>
<img type="image" data-ng-src="{{curIcon}}" ng-click="icon()"
class="responsive" />
</center>
</div>
</section>
.responsive {
max-width: 100%;
height: auto;
}
.imagewh {
position: relative;
width: 110px;
height: 110px;
}

我正在使用 angularjs,找不到解决方案请帮助我。

最佳答案

使用 flexbox :

.imagewh {
position: relative;
width: 110px;
height: 110px;
border: 1px solid grey;
display: flex;
justify-content: center;
align-items: center;
}
<div class="imagewh">
<img src="https://cataas.com/cat" width="20" height="20" />
</div>

关于angularjs - 无法将图像放在中心,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51713106/

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