svg+css实现35个ai模型细分市场大类图标列表代码

代码语言:html

所属分类:布局界面

代码描述:svg+css实现35个ai模型细分市场大类图标列表代码

代码标签: svg+css ai 模型 细分 市场 大类 图标 列表 代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>分类列表</title>
    <style>
        /* 重置与基础样式 */
        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
            background-color: #f3f4f6;
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            color: #374151;
        }

        /* 容器样式 */
        .container {
            width: 100%;
            max-width: 800px;
            background: #ffffff;
            border-radius: 12px;
            box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
            overflow: hidden; /* 包含阴影 */
            position: relative;
            padding: 0 32px; /* 为两侧渐变留出空间 */
        }

        /* 分类滚动区域 */
        .no-scrollbar {
            display: flex;
            gap: 1.75rem; /* gap-7 */
            overflow-x: auto;
            overscroll-x-none;
            padding: 1.5rem 0; /* pt-6 pb-5 */
            scrollbar-width: none; /* Firefox */
        }
        .no-scrollbar::-webkit-scrollbar {
            display: none; /* Chrome/Safari */
        }

        /* 单个分类选项 */
        label {
            cursor: pointer;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 0.375rem; /* gap-1.5 */
            font-size: 0.82rem; /* text-[.82rem] */
            line-height: 1.25; /* leading-tight */
            color: #6b7280; /* text-gray-500 */
            transition: color 0.2s;
            flex-shrink: 0; /* 防止压缩 */
        }

        label:hover {
            color: #374151; /* hover:text-gray-700 */
        }

        /* 隐藏的 Radio Input */
        .form-input {
            position: absolute;
            width: 1px;
            height: 1px;
            padding: 0;
            margin: -1px;
            overflow: hidden;
            clip: rect(0, 0, 0, 0);
            white-space: nowrap;
            border-width: 0;
        }

        /* 选中状态样式 */
        .form-input:checked + div {
            color: #4338ca; /* peer-checked:text-indigo-700 */
        }

        /* 图标样式 */
        svg {
            font-size: 1.5rem; /* text-2xl */
        }

        /* 两侧渐变遮罩层 */
        .gradient-mask {
            position: absolute;
            top: 0;
            bottom: 0;
            width: 32px; /* sm:w-32 */
            z-index: 10;
            pointer-events: none; /* 允许点击穿透 */
            display: flex;
            align-items: center;
        }

        .gradient-left {
            left: 0;
            background: linear-gradient(to right, white 0%, transparent 100%);
        }

        .gradient-right {
            right: 0;
            background: linear-gradient(to left, white 0%, transparent 100%);
        }

        /* 翻转按钮容器(用于右渐变) */
        .flex-row-reverse {
            flex-direction: row-reverse;
        }

        /* 按钮样式 */
        .scroll-btn {
            pointer-events: auto; /* 恢复按钮点击 */
            display: flex;
            height: 100%;
            align-items: center;
            padding: 0 0.5rem;
            cursor: pointer;
            color: #6b7280; /* text-gray-500 */
            font-size: 1.5rem;
            transition: color 0.2s;
            background: transparent;
            border: none;
        }

        .scroll-btn:hover {
            color: #374151; /* hover:text-gray-700 */
        }

        /* 暗色模式适配 (可选) */
        @media (prefers-color-scheme: dark) {
            body {
                background-color: #111827;
            }
            .container {
                background-color: #1f2937;
                box-shadow: 0 4px 6px -1px rgba(0,0,0,0.5);
            }
            label {
                color: #d1d5db; /* dark:text-gray-300 */
            }
            label:hover {
                color: #f3f4f6; /* dark:hover:text-gray-100 */
            }
            .form-input:checked + div {
                color: #eab308; /* dark:peer-checked:text-yellow-500 */
            }
            .scroll-btn {
                color: #d1d5db;
            }
            .scroll-btn:hover {
                color: #f3f4f6;
            }
            .gradient-left {
                background: linear-gradient(to right, #1f2937 0%, transparent 100%);
            }
            .gradient-right {
                background: linear-gradient(to left, #1f2937 0%, transparent 100%);
            }
        }

        /* 响应式调整 */
        @media (max-width: 640px) {
            .container {
                padding: 0;
            }
            .gradient-mask {
                width: 2rem; /* w-8 */
            }
            .scroll-btn {
                display: none; /* max-sm:hidden */
            }
        }
    </style>
</head>
<body>

    <div class="container">
        <!-- 左侧渐变遮罩 -->
        <div class="gradient-mask gradient-left">
            <button class="scroll-btn" aria-label="向左滚动">
                <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path fill-rule="evenodd" clip-rule="evenodd" d="M13.55 16 21 6.56l-1.57-1.24-7.94 10.06L11 16l.49.62 7.94 10.06L21 25.44 13.55 16Z" fill="currentColor"></path></svg>
            </button>
        </div>

        <!-- 中间滚动内容区域 -->
        <div class="no-scrollbar">
            <!-- Image Generation -->
            <label id="category-0">
                <input class="form-input" type="radio" value="0">
                <div>
                    <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path fill-rule="evenodd" clip-rule="evenodd" d="M24.4 .........完整代码请登录后点击上方下载按钮下载查看

网友评论0