You can use clip-path
to do that. You can just add
clip-path: inset(0 0 0 0);
to your body. You can see a working snippet below:
body {
margin: 0 auto;
clip-path: inset(0 0 0 0);
}
.hidden {
position: relative;
left: -50px;
}
/*----- Decoration -----*/
body {
border: 5px solid red;
height: 2000px;
width: 80%;
}
.hidden {
display: flex;
align-items: center;
text-align: center;
height: 100px;
width: 100px;
background-color: green;
}
body::after {
content: "Container";
position: absolute;
left: 50%;
top: 50%;
}
/*-----------------------*/
<div class="hidden" >Should be hidden</div>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…