我已经看过载荷并尝试了几种不同的代码,但没有任何对我有用..
我有这个网站,我想把这个数字计数器放在中间位置。
我试过,text-align,margin 0 auto,没有任何效果,或者我在错误的地方输入它。
这就是它的样子:
这是HTML:
<section class="bg-primary" id="about">
<div class="container">
<div class="row">
<div class="col-lg-8 col-lg-offset-2 text-center">
<h2 class="section-heading">We've got what you need!</h2>
<hr class="light">
<p class="text-faded">We are a creative staffing agency that gets your brand in front of your core audience, for a one-to-one interaction. Creating an impactful and eganging brand experience.</p>
<div id="shiva"><span class="count">300</span></div>
<div id="shiva"><span class="count">78</span></div>
<div id="shiva"><span class="count">32</span></div>
</div>
</div>
</div>
</section>
CSS:
#shiva
{
margin: 25px;
float: left;
}
.count
{
line-height: 100px;
color:black;
font-size:50px;
}
答案 0 :(得分:3)
这应该这样做:
<div id="container">
<div id="shiva"><span class="count">300</span></div>
<div id="shiva"><span class="count">78</span></div>
<div id="shiva"><span class="count">32</span></div>
</div>
#container {
width: 100%;
text-align: center;
}
答案 1 :(得分:3)
答案 2 :(得分:0)
你可以试试......
<div class="parent">
<div id="shiva"><span class="count">300</span></div>
<div id="shiva"><span class="count">78</span></div>
<div id="shiva"><span class="count">32</span></div>
</div>
.parent {
margin:auto;
display:table;
}