【发布时间】:2022-01-10 08:52:58
【问题描述】:
问题
当我尝试使用代码时(见下文),只有当我使用width: 100px; 时,div 才会居中。
<div style="border: solid 1px black; width: 100px; height: 100px; background-color: blue; margin-left: auto; margin-right: auto;">
由于我想为文本分配更长的宽度并将宽度设置为500px,因此 div 不再居中。
<div style="border: solid 1px black; width: 500px; height: 100px; background-color: blue; margin-left: auto; margin-right: auto;">
问题 #2
svg 没有居中
<div class="col-xl-3 col-lg-3 col-sm-6">
<div class="ud-single-feature wow fadeInUp" data-wow-delay=".25s" >
<div class="ud-feature-icon" >
<i class="lni lni-layers"></i>
</div>
<div class="ud-feature-content" style="position:absolute; width: 100%; text-align: center;">
<h3 class="ud-feature-title" style="text-align: center;">test</h3>
<p class="ud-feature-desc" style="text-align: center;">
test
</p>
<!-- <a href="javascript:void(0)" class="ud-feature-link">
Learn More
</a>-->
</div>
</div>
</div>
【问题讨论】:
标签: javascript html css center