使用显示表和浮动的响应网格

时间:2015-04-23 07:29:33

标签: javascript jquery html css

DEMO:http://jsfiddle.net/5adjhd1x/2/

如何使拨号盘响应下方?我尝试使用33%的宽度和演示1中的一些JS:http://jsfiddle.net/5adjhd1x/,但我没有它们的余量。



.key {
    width:40px;
    height:40px;
    background:red;
    float:left;
    border-radius:50%;
    cursor:pointer;
    text-align: center;
    display:table;
    margin:1%;
}
.key > span {
    display:table-cell;
    vertical-align:middle;
}
.clearFloat {
    clear:both;
}

<div class="keyWrap">
    <div class="key"><span>1</span>

    </div>
    <div class="key"><span>2</span>

    </div>
    <div class="key"><span>3</span>

    </div>
    <div class="clearFloat"></div>
    <div class="key"><span>4</span>

    </div>
    <div class="key"><span>5</span>

    </div>
    <div class="key"><span>6</span>

    </div>
    <div class="clearFloat"></div>
    <div class="key"><span>7</span>

    </div>
    <div class="key"><span>8</span>

    </div>
    <div class="key"><span>9</span>

    </div>
    <div class="clearFloat"></div>
    <div class="key"><span>0</span>

    </div>
    <div class="key dlt"><span>Del</span>

    </div>
</div>
    
    <br>    <br>
&#13;
&#13;
&#13;

如何让他们有百分比和响应的保证金?

1 个答案:

答案 0 :(得分:1)

在这里回答dude:

http://jsfiddle.net/5adjhd1x/6/

给我一​​个喜欢的!

.key {overflow: hidden; display: block; background: grey; padding: 0;}
.key li {width: 32%; margin-right: 2%; margin-bottom: 10px; float: left; display: inline-block; background: red;}
.key li:nth-child(3n) {margin-right: 0%;}