gpt4 book ai didi

html - 如何以我的风格居中文本?

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

我试图将我的文本“EXAMPLE”居中。我的 span 标签中有文本对齐中心,但它没有居中。我只想要“示例”中心而不是其他文本。

查看我的 jsfiddle:http://jsfiddle.net/huskydawgs/dx5fe6x5/

HTML

<p class="textbox">
<span style="text-align:center; color:#2251a4; font-weight:bold;letter-spacing: 10px;">EXAMPLE</span><br><br> The powers of the Company shall be exercised by or under the authority of, and the business and affairs of the Company shall be managed under the direction of, one or more managers. The Manager(s) shall be: Jane Doe, John Doe and Yogi Berra.</p>

CSS

.textbox {
padding: 8px 12px;
color: #555555;
background-color: #F1F1F1;
border: #e2e3e4 2px solid;
}

最佳答案

添加display:block;到 span 样式:

.textbox {
padding: 8px 12px;
color: #555555;
background-color: #F1F1F1;
border: #e2e3e4 2px solid;
}
.title{
text-align:center;
color:#2251a4;
font-weight:bold;
letter-spacing: 10px;
display:block;

}
<p class="textbox">
<span class="title">EXAMPLE</span>
he powers of the Company shall be exercised by or under the authority of, and the business and affairs of the Company shall be managed under the direction of, one or more managers. The Manager(s) shall be: Jane Doe, John Doe and Yogi Berra.
</p>

我强烈建议您不要使用内联样式,而只使用 <br>是应该使用它们的地方, 不是结构!
JSFiddle Demo

关于html - 如何以我的风格居中文本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28422516/

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