css步骤条

html 代码以及样式

html 复制代码
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>css步骤条</title>
    <style>
        .steps {
            display: flex;
            justify-content: space-between;
            padding: 0;
            margin: 20px 10px;
            list-style: none;
            counter-reset: order; /* 定义css 计时器 */
            --normal-color: #666;
            --active-color: #06e;
        }

        .steps li {
            counter-increment: order; /* 选择器增量 */
            color: var(--active-color); /* 定义变量,默认都是高亮颜色 */
        }

        .steps li::before {
            content: counter(order); /* 使用计数器的数字作为内容 */
            display: inline-block;
            width: 1.4em;
            margin-right: 0.5em;
            text-align: center;
            border-radius: 50%;
            border: 1px solid; /* 这里故意不设置颜色,将来使用继承的颜色 */
            flex-shrink: 0; /* 行内伪元素,实现计数器 */
        }

        /* 步骤项引导线 */
        .steps li {
            flex: auto; /* 弹性宽度(根据内容调整) */
            display: flex;
            align-items: center;
        }

        .steps li:not(:last-child)::after {
            content: '';
            flex: 1; /* 内部在开启flex自适应 */
            margin: 0 1em;
            border-bottom: 1px solid;
            opacity: 0.6;
        }

        .steps li:last-child {
            flex: none; /* 最后一项,没必要等分宽度 */
        }

        .steps .active::before {
            /* 设计激活时数字样式 */
            color: #ffffff;
            background: var(--active-color);
            border-color: var(--active-color);
        }

        .steps .active::after,
        .steps .active ~ li {
            /* 后面的线和step设置成黑色 */
            color: var(--normal-color);
        }

    </style>
</head>
<body>

<ol class="steps">
    <li>注册</li>
    <li class="active">域认证</li>
    <li>身份校验</li>
    <li>开通账号</li>
</ol>
</body>
</html>
相关推荐
SizeTheMoment19 天前
List介绍
1024程序员节
开利网络20 天前
产业互联网+三融战略:重构企业增长密码
大数据·运维·服务器·人工智能·重构·1024程序员节
wei_shuo1 个月前
从数据中台到数据飞轮:实现数据驱动的升级之路
1024程序员节·数据飞轮
玖剹1 个月前
矩阵区域和 --- 前缀和
数据结构·c++·算法·leetcode·矩阵·动态规划·1024程序员节
jamison_12 个月前
文心一言与 DeepSeek 的竞争分析:技术先发优势为何未能转化为市场主导地位?
人工智能·ai·chatgpt·gpt-3·1024程序员节
NaZiMeKiY2 个月前
HTML5前端第六章节
前端·html·html5·1024程序员节
jamison_13 个月前
颠覆未来:解锁ChatGPT衍生应用的无限可能(具体应用、功能、付费模式与使用情况)
ai·chatgpt·1024程序员节
NaZiMeKiY3 个月前
HTML5前端第七章节
1024程序员节
earthzhang20213 个月前
《Python深度学习》第四讲:计算机视觉中的深度学习
人工智能·python·深度学习·算法·计算机视觉·numpy·1024程序员节
明明真系叻3 个月前
2025.3.2机器学习笔记:PINN文献阅读
人工智能·笔记·深度学习·机器学习·1024程序员节·pinn