gpt4 book ai didi

css - 如何在 CSS 中对齐文本

转载 作者:太空宇宙 更新时间:2023-11-03 23:03:39 24 4
gpt4 key购买 nike

我想像这样对齐文本:

enter image description here

但我的显示如下:

enter image description here

CSS 代码:

  .caption > p
{
color: black;
width: 100%;
margin-top: 0px;
text-align: center;
}

HTML:

  <div class="col-sm-3 col-md-3">
<div class="thumbnail">
<div class="caption">
<h3>Preventive Maintenance</h3>
<p>
As a team starts to schedule preventive maintenance they need a reliable
work calendar. CMMS systems are especially good at scheduling recurring work and sending
reminders to the right people. Organized scheduling helps even out the workload for a
maintenance team making sure that tasks do not get forgotten
</p>
</div>
</div>
</div>

我已经尝试了float: left, 和float: right 但它不起作用,有什么技巧可以解决这个问题吗?

最佳答案

使用text-align: justify;代替text-align: center;

参见 https://developer.mozilla.org/en/docs/Web/CSS/text-align#Values更多选择

关于css - 如何在 CSS 中对齐文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35545004/

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