gpt4 book ai didi

html - 如何在 3 列内水平对齐图片及其标题

转载 作者:行者123 更新时间:2023-11-28 02:52:20 24 4
gpt4 key购买 nike

我使用 bootstrap 创建了三列,每列包含一张图片和一个标题。像这样:

enter image description here

但是,我希望它实际输出这样的内容:

enter image description here

这是我当前的代码:

<!-- Section 6 -->
<div class="cssSection cssCenter">
<div class="container">
<h2>The Order</h2>
<br>
<p class="cssInformation">Labelled as a religious order, the Knights Templars established a set of rules by which their members would follow.</p>
<br>
<div class="row">
<div class="col-sm-4">
<img class="img-center img-responsive" src="http://placehold.it/400x275">
<br>
<p>The Templars swore to an oath of poverty, chastity, obedience and renounced the world.</p>
</div>
<div class="col-sm-4">
<img class="img-center img-responsive" src="http://placehold.it/400x275">
<br>
<p>The Templars lived within their own community, which meant sleeping in a common dorm, while also eating their meals in union. Lorem ipsum sont dolor sit amet. Lorem ipsum sont dolor sit amet.Lorem ipsum sont dolor sit amet.</p>
</div>
<div class="col-sm-4">
<img class="img-center img-responsive" src="http://placehold.it/400x275">
<br>
<p>The Templars refrained from becoming drunk, gambling and swearing</p>
</div>
</div>
</div>
</div>

这是相关的 CSS 代码:

.cssSection {
padding: 45px 0 30px;
}

.cssCenter {
text-align: center;
}

.cssInformation {
font-size: 18px;
}

我可以在 HTML 和/或 CSS 中调整什么来使 p 标签水平对齐,而不影响图像?

最佳答案

您确定没有添加其他 css 吗?我在 jsfiddle 上试过你的代码(添加 Bootstrap ),它对我来说很好。

关于html - 如何在 3 列内水平对齐图片及其标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38907842/

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