gpt4 book ai didi

HTML/CSS (Bootstrap) - 为什么我的文本没有居中?

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

出于某种原因,my text isn't being centered on the page即使我有标题文本的“文本中心”类。我做错了什么?

<div class="text-center">
<h1>Evelyn Lauder </h1>
<h5 class="font-italic"> 1936-2011</h5>
<img src="http://i.telegraph.co.uk/multimedia/archive/02093/lauder_2093473b.jpg" alt="Evelyn Lauder" /> <br /><br>
</div>
<div style= "width: 50%"; class="text-center font-italic">
<h7> "Evelyn Lauder was an Austrian American businessman who was well known for popularzing the pink ribbon associated with breast cancer awareness." </h7>
</div>

最佳答案

要么去掉宽度...

<div class="text-center font-italic">

如果您希望 div 为 50% 并且在中间,则添加 margin-left...

<div style= "width: 50%; margin-left:25%;" class="text-center font-italic">

Codepen 链接: https://codepen.io/anon/pen/zpWOod

关于HTML/CSS (Bootstrap) - 为什么我的文本没有居中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48181724/

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