中心多个div数计数器

时间:2016-05-05 10:46:39

标签: jquery html css division

我已经看过载荷并尝试了几种不同的代码,但没有任何对我有用..

我有这个网站,我想把这个数字计数器放在中间位置。

我试过,text-align,margin 0 auto,没有任何效果,或者我在错误的地方输入它。

这就是它的样子:

enter image description here

这是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;
}

3 个答案:

答案 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)

尝试以下

ActiveListWB

https://fiddle.jshell.net/zmtLatn9/

答案 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;
}