web之div区块篇

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Div标签的嵌套</title>
    <style type="text/css">
        .inline_div{display: inline-block;    /* 行内显示方式,设置以后两个div区块就同一行显示啦 */}
        #wrap{width: 450px; height: 250px; border: 2px solid black;}
        #d1,#d2{height: 100px; width: 40%; background-color: green; margin: 20px;}   /* margin表示的是边距,auto为居中,一个参数为四边,两个为左右上下,四个为上下左右都设置 */
        #d2{background-color: yellow;}
        #d3{height: 100px; width: 90%; border: 2px solid black; background-color: #66ff33; margin: 0px auto;}
        h3{font-size: 28px; color: #0033ff;}
    </style>
</head>
<body>
    <h3>图层嵌套的应用</h3>
    <div id="wrap">
        <div id="d1" class="inline_div">div1</div>
        <div id="d2" class="inline_div">div2</div>
        <div id="d3">div3</div>
    </div>
</body>
</html>
发布了151 篇原创文章 · 获赞 93 · 访问量 10万+

猜你喜欢

转载自blog.csdn.net/qq_40258748/article/details/101079546