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,

相关推荐
Mh2 小时前
基于踩过的坑,浅聊一下vh、svh、lvh、dvh
前端·css·设计模式
刘小灰2 小时前
返璞归真,我开始更新博客了
前端·后端
圆心角3 小时前
Agent 上下文原理:为什么“记住”比“推理”更难
前端·面试·agent
杜子不疼.6 小时前
从 Apache HTTP Server 到 CivetWeb:在鸿蒙 PC 的 3.1 MiB HAP 里嵌入 Web 服务器
前端·apache·harmonyos
kyriewen7 小时前
AI 生成率进了 KPI,最慌的是写代码最快的人
前端·javascript·程序员
SoaringHeart7 小时前
Flutter组件封装:聊天气包图片组件NChatBubble
前端·flutter
狗头大军之江苏分军8 小时前
三个月的电商心得
前端·后端
勤恳的马龙11 小时前
给 1088 个工具页批量注入 FAQ 和结构化数据:一次幂等的 SEO 工程
前端·javascript
htzyl20611 小时前
javaScript中,让你全面了解动态import()的四个真实用途,及与静态import的区别
前端·javascript
钉先生贾12 小时前
HarmonyOS 7.0 性能排障实战 43:图片与大资源加载抖动时,怎样区分解码、布局与状态更新
java·前端·harmonyos