如何在CSS上软化溢出的边缘



当向下滚动时子div溢出时,我正试图软化橙色div的尖锐边缘。我可以用CSS做到这一点吗?如果我的解释令人困惑,我很抱歉。

屏幕截图

我给你举了一个例子,你可以在页眉和页脚中添加box-shadow,这样你就可以在元素之间创建模糊效果。

body{
background-color: #888888;
}
header{
width: 100%;
height: 50px;
box-shadow: 0 10px 8px 10px #888888;
background-color: #888888;
/* this is important so the box-shadow is displayd on top of the next element */
position: relative;
z-index: 1
}
div{
width: 100%;
height: 100px;
background-color: red;
}
<body>
<header></header>
<div> </div>
</body>

最新更新