gpt4 book ai didi

html - bootstrap 3 中的图像不会移动到中心

转载 作者:行者123 更新时间:2023-11-28 04:36:14 25 4
gpt4 key购买 nike

所以我正在制作一个网站,我试图让我的图像位于中心或下方一点,但它不会发生。每次我尝试它都停留在 t`enter code here

<img src="http://i2.wp.com/ajournalofmusicalthings.com/wp-content/uploads/Question-mark.png?resize=512%2C350" alt="..." class="img-thumbnail">
<img src="http://i2.wp.com/ajournalofmusicalthings.com/wp-content/uploads/Question-mark.png?resize=512%2C350" alt="..." class="img-thumbnail">
<img src="http://i2.wp.com/ajournalofmusicalthings.com/wp-content/uploads/Question-mark.png?resize=512%2C350" alt="..." class="img-thumbnail">



.image-thumbnail {
position: absolute;
top: 80%;
left: 50%;
transform: translateX(-50%) translateY(-50%);
background-color: #3B393E;
}

我不明白我做错了什么。

最佳答案

然后将其包裹在一个 div 中并使用 text-align:center 来完成这项工作:

.image-thumbnail{transform:translateX(-50%) translateY(-50%); background-color: #3B393E;}

.myclass {
width: 100%;
text-align: center;
}
<div class="myclass">

<img src="http://i2.wp.com/ajournalofmusicalthings.com/wp-content/uploads/Question-mark.png?resize=512%2C350" alt="..." class="img-thumbnail">
<img src="http://i2.wp.com/ajournalofmusicalthings.com/wp-content/uploads/Question-mark.png?resize=512%2C350" alt="..." class="img-thumbnail">
<img src="http://i2.wp.com/ajournalofmusicalthings.com/wp-content/uploads/Question-mark.png?resize=512%2C350" alt="..." class="img-thumbnail">

</div>

关于html - bootstrap 3 中的图像不会移动到中心,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41455332/

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