gpt4 book ai didi

css - 如何使用 Bootstrap 3 将两个图像并排居中?

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

我似乎无法将类“social”的两个图像并排放置在“col-sm-4”类列的中心。相反,它们会随着屏幕尺寸的减小而堆叠。有什么想法可以响应式地执行此操作吗?

HTML

<div class="container-fluid">
<div class="row" style="border-top: 0">
<!-- Profile info -->
<div class="col-sm-4 col-sm-offset-4">
<img class="img-circle img-responsive" src="images/callum.jpg">
<h1 class="text-center" style="color: #3FA2B2">Callum Messiter</h1>
<p class="text-center">100-trillion cells and 100-billion neurons defying the 1 in 10<sup>2,685,000</sup> chance of me existing.</p>
<img class="social" src="images/twitter.png">
<img class="social" src="images/github.png">
</div>
</div>
</div>

CSS

.row{
border-top: 1px solid #808080;
padding-left: 10px;
padding-right: 10px;
padding-bottom: 10px;
}

.col-sm-4{
height: 450px;
}

.img-circle{
height: 200px;
width: 200px;
margin: 0 auto;
position: relative;
top: 40px;
border: 2px solid white;
}

.text-center{
font-family: helvetica;
color: white;
position: relative;
top: 50px;
}

span{
font-weight: bold;
background-color: #e6e6e6;
color: #3FA2B2;
padding: 3px 7px 3px 7px;
}

.social{
height: 50px;
width: 50px;
margin: 0 auto;
}

最佳答案

在 img 之前添加类 text-center。像这样

<div class="text-center">
<img class="social" src="https://files.allaboutbirds.net/wp-content/themes/html5blank-stable/images/blue-winged-warbler.jpg">
<img class="social" src="https://files.allaboutbirds.net/wp-content/themes/html5blank-stable/images/blue-winged-warbler.jpg">
</div>

此处演示 https://jsfiddle.net/ff9g43t8/

关于css - 如何使用 Bootstrap 3 将两个图像并排居中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38689159/

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