如何使包含 div 的溢出隐藏在包含 div 的内部

How do I make a containing div overflow hidden inside it's containing div

我正在尝试提供我正在制作的这个简单的计算器应用程序 'light sheen',就像您在 phone 屏幕上在灯光下看到的一样。我所做的是,我在包含 div 的 phone 形状内放置了一个 div 来表示光的光泽,但我做不到,所以隐藏了溢出光的光泽 div.

希望当前的代码片段对您有所帮助:

<div class="phone-container">
        <div class="light-sheen"></div>
        <div class="upper-icons">
.phone-container {
    height: 750px;
    width: 400px;
    background: rgb(0, 0, 0);
    border-radius: 60px;
    border: 5px solid rgb(172, 172, 172);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    padding-bottom: 50px;
    overflow: hidden;
}

.light-sheen {
    width: 900px;
    height: 450px;
    background-color: white;
    position: absolute;
    bottom: 0px;
    transform: rotateZ(-35deg);
    opacity: 0.1;
}

感谢任何帮助,谢谢!

因为你在light-sheen上使用position: absolute;,所以无法隐藏溢出部分。

改成浅色position: relative;

.light-sheen {
    width: 900px;
    height: 450px;
    background-color: white;
    position: relative;
    bottom: 0px;
    transform: rotateZ(-35deg);
    opacity: 0.1;
}