下滑滚动阴影解决方案

1. backgroud,限制高度,加overflowcodeopen, 只是在内容上边加阴影

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了。。。。

 

 

posted @   everseven  阅读(45)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 25岁的心里话
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现
点击右上角即可分享
微信分享提示