Hello, how to make the black square not clipped by overflow: hidden and that the corners are rounded, thanks
.block { width: 300px; height: 300px; margin: 100px 100px; border-radius: 10px; overflow: hidden; } .block2 { width: 100%; height: 150px; background: red; } .block1 { width: 100%; height: 150px; background: green; position: relative; } .img { width: 50px; height: 50px; position: absolute; left: 50%; margin-left: -25px; top: -25px; background: black; } <div class="block"> <div class="block1"> <div class="img"></div> </div> <div class="block2"></div> </div>
oveflow: hiddenproperty just means "hide everything that goes beyond." You put the property "hide all that goes beyond the limits" and ask how to make that "that which goes beyond the limit was not hidden", the most logical answer is to remove this veryoverflow: hidden. You have been given several answers here, I propose to accept one of them, or edit your question (clarify whether theoverflow: hiddenproperty can be removed or not) - Alexander Kazakov