小编opr*_*z17的帖子

如何使div低于另一个div

我希望#bluediv下面的#greendiv

#bluediv有margin-top : -10px; attribute

 <style>
    #red{
        width: 400px;

        border: 1px solid red;
    }
    #green{
        width: 100%;
        height: 100px;
        background-color: green;
        border-bottom: 2px solid yellow;
        z-index: 2;
    }
    #blue{
        width: 100%;
        height: 100px;
        background-color: blue;
        border-top: 2px solid brown;
        margin-top: -10px;
        z-index: 1;
    }
    </style>


<div id="red">
    <div id="green">
    </div>
    <div id="blue">
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

html css margin

1
推荐指数
1
解决办法
2万
查看次数

标签 统计

css ×1

html ×1

margin ×1