-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
全宽的上方阴影 #8
Labels
effect
construct of some effect
Comments
.sub-bar {
/* offset-x | offset-y | blur-radius | spread-radius | color */
box-shadow: 2px 2px 2px 1px rgba(0, 0, 0, 0.2);
} .sub-bar {
box-shadow: 0 -5px 5px -5px rgba(0, 0, 0, 0.3)
} .sub-bar {
box-shadow: 0 -2.5px 5px -2.5px rgba(0, 0, 0, .3)
} 但是由于 blur 拥有圆角,上方全宽的阴影会在左右溢出,左右不溢出的上方不能均匀全宽。 把第二个例子的阴影颜色加深后如上图。单靠 |
1. overflow: hidden这个很简单,就是在父元素上把其他边的阴影给隐藏掉 .container {
position: relative;
overflow-x: hidden;
overflow-y: auto;
} |
2. clip-path同样是把其他边隐藏掉,使用 .sub-bar {
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
clip-path: polygon(0 -5px, 100% -5px, 100% 100%, 0% 100%)
} 顺便推荐一个在线生成器:http://bennettfeely.com/clippy/ |
3. 阴影元素不用 sub-bar 自带的阴影了,自己写一个 .shadow {
position: absolute;
bottom: 20px;
left: 0;
width: 100%;
height: 5px;
background: linear-gradient(transparent, rgba(0, 0, 0, .15));
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👆要达到这个效果,底 bar 在可滚动内容上有一个上阴影
放大一点:
The text was updated successfully, but these errors were encountered: