初试css3 calc 属性

来源:互联网 发布:java面向对象知识点 编辑:程序博客网 时间:2024/06/02 03:20
<!DOCTYPE html><html><head>    <meta charset="utf-8">    <title>测试calc</title>    <meta name="viewport" content="width=device-width, initial-scale=1">    <style type="text/css">    * {        margin: 0;        padding: 0;    }    section {        box-sizing: border-box;        float: left;        width: calc(100%/3 - 3px);        margin-right: calc(9px/2);        height: 100px;        border: 1px solid #dedede;    }    section:nth-child(3) {        margin-right: 0;    }    </style></head><body>    <div class="container">        <section>1</section>        <section>2</section>        <section>3</section>        <section>4</section>    </div></body></html>
原创粉丝点击