在我的一行中,我想设置最大宽度并将文本置于该 div 的中心。
我的主页文本目前如下所示::
我想设置最大宽度并将文本居中放置在这一节中。
理想结果:
CSS
.homepage-text {
font-size: 130%;
}
.light-section {
background-color: lightblue;
/* color: white; */
text-align: center:
}
HTML
<div class="row light-section">
<div class="col-sm-12">
<div class="col-sm-12 homepage-text">
<p>Text sit's here</p>
</div></div></div>
最佳答案
也许我不明白你的意思,但试试这个:
.homepage-text {
font-size: 130%;
max-width: 1000px;
margin: 0 auto;
float: none;
}
关于html - 将最大宽度并在父级中间对齐文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36267953/