下滑滚动阴影解决方案
1. backgroud,限制高度,加overflow,codeopen, 只是在内容上边加阴影
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | .g-scroll { top: -1px; position: relative; height: 500px; overflow-y: scroll; overflow-x: hidden; background: linear-gradient( #fff, transparent) top / 100% 100px, radial-gradient(at 50% -15px, rgba(0, 0, 0, .8), transparent 70%) top / 100000% 12px; background-repeat: no-repeat; background-attachment: local, scroll; } // 限制内容高度 <div class = "form-content g-scroll " > |
2. shadow标签,计算宽度,没有限制 不是全屏,需要计算宽度, dom结构,header->shadow->main
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | header{ position: sticky; background: #fff; top: 0; font-size: 20px; padding: 10px; z-index: 1; } shadow::before{ content: '' ; box-shadow: 0 0 10px 1px #333; position: fixed; width: 100%; } shadow::after{ content: '' ; width: 100%; height: 30px; background: linear-gradient(to bottom, #fff 50% , transparent); position: absolute; }<br>fixed是相对于html中window元素的,所以如果纯CSS你是不能实现和其父元素宽度相等的,给你两个解决方案:<br>1、fixed下设置width和其父元素值相等;<br>2、fixed换成absolute; |
3. 样式再复杂一点就要用js了。。。。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 25岁的心里话
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现