css 步骤条虚线渐变色效果实现

效果如图所示:

思路:

使用元素覆盖的方式实现视觉上虚线的效果

实现代码:

html布局

html 复制代码
<ul class="details-cont">
    <li class="details-li" v-for="item in 3" :key="item">
        <div class="li-status">{{ item }}</div>
        <div class="li-flow-box">
            <div class="flow-circle"></div>
            <div class="flow-line"></div>
            <div class="flow-line-other"></div>
        </div>
        <div class="li-details">
            <div class="details-top">文字</div>
            <div class="details-channel">文字文字文字</div>
            <div class="details-stream">文字文字文字文字</div>
        </div>
    </li>
</ul>

css样式

css 复制代码
.details-cont{
    padding: 0 rem(24);
    .details-li{
        display: flex;
        padding-bottom: rem(20);
        .li-flow-box{
            position: relative;
            padding: rem(5) 0 0;
            .flow-circle{
                width: rem(8);
                height: rem(8);
                border-radius: 50%;
                margin: 0 rem(7) 0 rem(5);
                background: #D7D7D7;
            }
            .flow-line{
                position: absolute;
                left: rem(9);
                top: rem(13);
                bottom: rem(-23);
                width: 1px;
                border-left: 1px dashed #D7D7D7;
            }
        }
        .li-details{
            flex: 1;
            font-size: rem(12);
            color: #999999;
            line-height: 18px;
            .details-channel,.details-stream{
                padding: rem(6) 0 0;
            }
        }
    }
    .details-li:last-child{
        .li-flow-box{
            .flow-line-other{
                position: absolute;
                left: rem(9);
                top: rem(13);
                bottom: rem(-23);
                width: 1px;
                border-left: 1px dashed #fff;
            }
            .flow-line{
                border-image: linear-gradient(180deg, rgba(215, 215, 215, 1), rgba(237, 237, 237, 0.49), rgba(215, 215, 215, 0)) 1 1
                
            }
        }
    }
}

PS:因为在移动端使用,单位代码使用统一的方法对rem进行了处理,此处rem(1),就相当于1px,

相关推荐
喝拿铁写前端22 分钟前
一套面向 Web、H5、小程序与 Flutter 的多端一致性技术方案
前端·架构
yaaakaaang27 分钟前
(一)前端,如此简单!---下载Nginx
前端·nginx
牛奶33 分钟前
为什么全国人民都能秒开同一个视频?
前端·http·cdn
KongHen021 小时前
uniapp-x实现自定义tabbar
前端·javascript·uni-app·unix
汪子熙1 小时前
TS2320 错误的本质、触发场景与在 Angular / RxJS 项目中的系统化应对
前端·javascript·angular.js
我命由我123451 小时前
React - BrowserRouter 与 HashRouter、push 模式与 replace 模式、编程式导航、withRouter
开发语言·前端·javascript·react.js·前端框架·html·ecmascript
Younglina1 小时前
用AI全自动生成连环画?我试了,效果惊艳!
前端·ai编程·claude
Devin_chen1 小时前
ES6 Class 渐进式详解
前端·javascript
小番茄夫斯基1 小时前
前端开发的过程中,需要mock 数据,但是走的原来的接口,要怎么做
前端·javascript
peachSoda72 小时前
前端想转AI全栈-初步练习记录
前端·人工智能