margin负——盒子的覆盖

top、left为负——当前元素盖别人
bottom、right为负——后面元素盖过来

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box1 {
            background-color: pink;
             300px;
            height: 48px;
            overflow: hidden;
            /* 粉盒子区域变小(被下面盒子盖住了),但粉盒子里面的文字不变 */
            /* margin: 0 3px -30px 0; */
        }
        
        .box2 {
            background-color: blue;
             300px;
            height: 30px;
        }
    </style>
</head>

<body>
    <div class="box1">盒子1盒子1盒子1盒子1盒子1盒子1盒子1盒子1盒子1盒子1盒子1盒子1盒子1盒子1盒子1盒子1盒子1盒子1盒子1盒子1盒子1盒子1盒子1</div>
    <div class="box2">喝茶2</div>
</body>

</html>
原文地址:https://www.cnblogs.com/icemiaomiao3/p/14128056.html