增强版 CSS 框架使用文档

目录

1. 框架概述 {#1-框架概述}

本框架是一个功能完整的 CSS 工具集,提供了全面的样式解决方案,包括:

  • 灵活的 12 列网格系统,支持多断点响应式设计
  • 完整的全局变量系统,便于主题定制
  • 丰富的工具类,覆盖布局、间距、边框、文本等场景
  • 统一的过渡与动画效果,提升用户体验
  • 标准化的基础样式重置,确保跨浏览器一致性

框架设计遵循 "移动优先" 原则,通过清晰的命名规范和模块化结构,使开发者能够快速构建一致、美观的界面。

2. 快速开始

  1. 引入框架

    将框架 CSS 文件引入到 HTML 文档的<head>中:

\<link rel="stylesheet" href="path/to/enhanced-css-framework.css">
  1. 基础结构

    一个典型的页面结构如下:

\<!DOCTYPE html>

\<html lang="zh-CN">

\<head>

&#x20; \<meta charset="UTF-8">

&#x20; \<meta name="viewport" content="width=device-width, initial-scale=1.0">

&#x20; \<title>框架示例\</title>

&#x20; \<link rel="stylesheet" href="path/to/enhanced-css-framework.css">

\</head>

\<body class="bg-background">

&#x20; \<div class="container">

&#x20;   \<div class="row">

&#x20;     \<div class="col-md-6">

&#x20;       \<!-- 内容 -->

&#x20;     \</div>

&#x20;     \<div class="col-md-6">

&#x20;       \<!-- 内容 -->

&#x20;     \</div>

&#x20;   \</div>

&#x20; \</div>

\</body>

\</html>

3. 全局变量

框架使用 CSS 变量(Custom Properties)定义全局样式,所有变量都在:root选择器下声明,便于统一修改和主题定制。

3.1 颜色系统

主题色

\--color-primary: #007BFF;              /\* 主色调 \*/

\--color-primary-light: #3395FF;        /\* 主色浅变体 \*/

\--color-primary-dark: #0056D2;         /\* 主色深变体 \*/

\--color-primary-transparent: rgba(0, 123, 255, 0.15); /\* 主色透明变体 \*/

\--color-primary-rgb: 0, 123, 255;      /\* 主色RGB值(用于rgba计算) \*/

\--color-secondary: #444;               /\* 辅助色 \*/

\--color-secondary-light: #666;

\--color-secondary-dark: #222;

背景色

\--color-background: #ffffff;           /\* 主要背景色 \*/

\--color-background-alt: #f9fafb;       /\* 交替背景色 \*/

\--color-background-hover: #f3f4f6;     /\* 悬停背景色 \*/

\--color-background-active: #e5e7eb;    /\* 激活背景色 \*/

\--color-background-card: #ffffff;      /\* 卡片背景色 \*/

\--color-background-modal: #ffffff;     /\* 模态框背景色 \*/

\--color-background-overlay: rgba(0, 0, 0, 0.5); /\* 遮罩层背景色 \*/

文本色

\--color-text: #000000;                 /\* 主要文本色 \*/

\--color-text-light: #374151;           /\* 浅色文本 \*/

\--color-text-lighter: #6B7280;         /\* 更浅文本 \*/

\--color-text-muted: #3d3d3d;           /\* 次要文本 \*/

\--color-text-disabled: #9CA3AF;        /\* 禁用文本色 \*/

\--color-text-inverse: #ffffff;         /\* 深色背景上的文本 \*/

功能色(状态色)

\--color-success: #52c41a;              /\* 成功色 \*/

\--color-warning: #fa8c16;              /\* 警告色 \*/

\--color-danger: #ff4d4f;               /\* 危险/错误色 \*/

\--color-info: #4096ff;                 /\* 信息色 \*/

中性色系

提供从--color-neutral-50(最浅)到--color-neutral-950(最深)的完整中性色阶,满足各种场景需求。

七色调全色系

包含红、橙、黄、绿、青、蓝、紫七个色系,每个色系都有从 50 到 950 的色阶变化,如:

/\* 红色系示例 \*/

\--color-red-50: #fff5f5;

\--color-red-100: #ffe3e3;

/\* ... 中间色阶省略 ... \*/

\--color-red-950: #5c0d12;

3.2 字体系统

\--font-family-main: 'Helvetica Neue', Helvetica, 'PingFang SC', ...; /\* 主要字体 \*/

\--font-family-mono: 'SF Mono', Menlo, Monaco, ...; /\* 等宽字体(代码用) \*/

\--font-family-display: var(--font-family-main); /\* 标题字体 \*/

/\* 字体大小 \*/

\--font-size-xs: 10px;

\--font-size-sm: 12px;

\--font-size-md: 13px;

\--font-size-lg: 14px;

\--font-size-xl: 16px;

\--font-size-2xl: 18px;

\--font-size-3xl: 22px;

\--font-size-4xl: 26px;

\--font-size-5xl: 32px;

\--font-size-6xl: 40px;

/\* 字体权重 \*/

\--font-weight-light: 300;

\--font-weight-normal: 400;

\--font-weight-medium: 500;

\--font-weight-semibold: 600;

\--font-weight-bold: 700;

\--font-weight-extrabold: 800;

/\* 行高 \*/

\--line-height-xs: 1.2;

\--line-height-sm: 1.3;

\--line-height-md: 1.5;

\--line-height-lg: 1.6;

\--line-height-xl: 1.8;

3.3 边框系统

/\* 边框宽度 \*/

\--border-width: 1px;

\--border-width-sm: 0.5px; /\* 细边框 \*/

\--border-width-lg: 2px;  /\* 粗边框 \*/

/\* 边框圆角 \*/

\--border-radius: 4px;

\--border-radius-sm: 2px; /\* 小圆角 \*/

\--border-radius-lg: 6px; /\* 大圆角化 \*/

\--border-radius-xl: 8px;

\--border-radius-full: 9999px; /\* 全圆角(圆形) \*/

/\* 边框颜色 \*/

\--color-border: #ccc;

\--color-border-light: #e5e7eb; /\* 浅色边框 \*/

\--color-border-dark: #9CA3AF;  /\* 深色边框 \*/

\--color-border-primary: var(--color-primary); /\* 主色边框 \*/

3.4 间距系统

\--spacing-0: 0;         /\* 零间距 \*/

\--spacing-xxs: 2px;     /\* 极小间距 \*/

\--spacing-xs: 4px;

\--spacing-sm: 5px;

\--spacing-md: 10px;

\--spacing-lg: 20px;

\--spacing-xl: 25px;

\--spacing-2xl: 32px;    /\* 更大间距 \*/

\--spacing-3xl: 40px;

\--spacing-4xl: 56px;

\--spacing-5xl: 72px;

3.5 阴影系统

\<!DOCTYPE html>

\<html lang="zh-CN">

\<head>

&#x20; \<meta charset="UTF-8">

&#x20; \<meta name="viewport" content="width=device-width, initial-scale=1.0">

&#x20; \<title>框架示例\</title>

&#x20; \<link rel="stylesheet" href="path/to/enhanced-css-framework.css">

\</head>

\<body class="bg-background">

&#x20; \<div class="container">

&#x20;   \<div class="row">

&#x20;     \<div class="col-md-6">

&#x20;       \<!-- 内容 -->

&#x20;     \</div>

&#x20;     \<div class="col-md-6">

&#x20;       \<!-- 内容 -->

&#x20;     \</div>

&#x20;   \</div>

&#x20; \</div>

\</body>

\</html>
0

3.6 过渡与动画

\<!DOCTYPE html>

\<html lang="zh-CN">

\<head>

&#x20; \<meta charset="UTF-8">

&#x20; \<meta name="viewport" content="width=device-width, initial-scale=1.0">

&#x20; \<title>框架示例\</title>

&#x20; \<link rel="stylesheet" href="path/to/enhanced-css-framework.css">

\</head>

\<body class="bg-background">

&#x20; \<div class="container">

&#x20;   \<div class="row">

&#x20;     \<div class="col-md-6">

&#x20;       \<!-- 内容 -->

&#x20;     \</div>

&#x20;     \<div class="col-md-6">

&#x20;       \<!-- 内容 -->

&#x20;     \</div>

&#x20;   \</div>

&#x20; \</div>

\</body>

\</html>
1

4. 网格系统

框架采用 12 列网格布局,通过容器(container)、行(row)和列(col)的组合实现灵活的页面布局。

4.1 容器

容器用于包裹网格内容,提供居中对齐和内边距控制。

类名说明最大宽度
.container基础容器1200px
.container-sm小型容器540px
.container-md中型容器720px
.container-lg大型容器960px
.container-xl特大型容器1140px
.container-xxl超大型容器1320px
.container-fluid流体容器100% 宽度

使用示例

\<!DOCTYPE html>

\<html lang="zh-CN">

\<head>

&#x20; \<meta charset="UTF-8">

&#x20; \<meta name="viewport" content="width=device-width, initial-scale=1.0">

&#x20; \<title>框架示例\</title>

&#x20; \<link rel="stylesheet" href="path/to/enhanced-css-framework.css">

\</head>

\<body class="bg-background">

&#x20; \<div class="container">

&#x20;   \<div class="row">

&#x20;     \<div class="col-md-6">

&#x20;       \<!-- 内容 -->

&#x20;     \</div>

&#x20;     \<div class="col-md-6">

&#x20;       \<!-- 内容 -->

&#x20;     \</div>

&#x20;   \</div>

&#x20; \</div>

\</body>

\</html>
2

4.2 行

行(Row)用于包裹列(Column),并提供负外边距抵消列的内边距,确保布局对齐。

类名说明
.row基础行
.row-gutter-sm小间距行(8px)
.row-gutter-lg大间距行(24px)

使用示例

\<!DOCTYPE html>

\<html lang="zh-CN">

\<head>

&#x20; \<meta charset="UTF-8">

&#x20; \<meta name="viewport" content="width=device-width, initial-scale=1.0">

&#x20; \<title>框架示例\</title>

&#x20; \<link rel="stylesheet" href="path/to/enhanced-css-framework.css">

\</head>

\<body class="bg-background">

&#x20; \<div class="container">

&#x20;   \<div class="row">

&#x20;     \<div class="col-md-6">

&#x20;       \<!-- 内容 -->

&#x20;     \</div>

&#x20;     \<div class="col-md-6">

&#x20;       \<!-- 内容 -->

&#x20;     \</div>

&#x20;   \</div>

&#x20; \</div>

\</body>

\</html>
3

4.3 列

列是网格系统的核心,通过指定占比来控制宽度。框架采用 12 列系统,每列的宽度为100% / 12 * 列数

基础列类

类名说明宽度占比
.col-11 列宽8.333%
.col-22 列宽16.666%
.........
.col-1212 列宽100%
.col自动分配宽度平均分配
.col-auto自动宽度由内容决定

使用示例

\<!DOCTYPE html>

\<html lang="zh-CN">

\<head>

&#x20; \<meta charset="UTF-8">

&#x20; \<meta name="viewport" content="width=device-width, initial-scale=1.0">

&#x20; \<title>框架示例\</title>

&#x20; \<link rel="stylesheet" href="path/to/enhanced-css-framework.css">

\</head>

\<body class="bg-background">

&#x20; \<div class="container">

&#x20;   \<div class="row">

&#x20;     \<div class="col-md-6">

&#x20;       \<!-- 内容 -->

&#x20;     \</div>

&#x20;     \<div class="col-md-6">

&#x20;       \<!-- 内容 -->

&#x20;     \</div>

&#x20;   \</div>

&#x20; \</div>

\</body>

\</html>
4

4.4 响应式断点

框架提供 6 个响应式断点,支持在不同屏幕尺寸下调整布局:

断点前缀断点值说明
xs0超小屏幕(手机,默认)
sm576px小屏幕(平板竖屏)
md768px中等屏幕(平板横屏)
lg992px大屏幕(笔记本 / 小桌面)
xl1200px特大屏幕(桌面)
xxl1400px超特大屏幕(大桌面)

响应式列类命名规则.col-[断点前缀]-[列数]

使用示例

\<!DOCTYPE html>

\<html lang="zh-CN">

\<head>

&#x20; \<meta charset="UTF-8">

&#x20; \<meta name="viewport" content="width=device-width, initial-scale=1.0">

&#x20; \<title>框架示例\</title>

&#x20; \<link rel="stylesheet" href="path/to/enhanced-css-framework.css">

\</head>

\<body class="bg-background">

&#x20; \<div class="container">

&#x20;   \<div class="row">

&#x20;     \<div class="col-md-6">

&#x20;       \<!-- 内容 -->

&#x20;     \</div>

&#x20;     \<div class="col-md-6">

&#x20;       \<!-- 内容 -->

&#x20;     \</div>

&#x20;   \</div>

&#x20; \</div>

\</body>

\</html>
5

4.5 列偏移

通过偏移类可以控制列的左侧留白,实现列的右移效果。

偏移类命名规则.offset-[断点前缀]-[偏移列数]

使用示例

\<!DOCTYPE html>

\<html lang="zh-CN">

\<head>

&#x20; \<meta charset="UTF-8">

&#x20; \<meta name="viewport" content="width=device-width, initial-scale=1.0">

&#x20; \<title>框架示例\</title>

&#x20; \<link rel="stylesheet" href="path/to/enhanced-css-framework.css">

\</head>

\<body class="bg-background">

&#x20; \<div class="container">

&#x20;   \<div class="row">

&#x20;     \<div class="col-md-6">

&#x20;       \<!-- 内容 -->

&#x20;     \</div>

&#x20;     \<div class="col-md-6">

&#x20;       \<!-- 内容 -->

&#x20;     \</div>

&#x20;   \</div>

&#x20; \</div>

\</body>

\</html>
6

4.6 列排序

通过排序类可以改变列的显示顺序,而不改变 HTML 结构。

排序类

类名说明
.order-first排在最前面
.order-last排在最后面
.order-[n]排在第 n 位(n 为 0-12)
.order-[断点前缀]-first在指定断点排在最前面
.order-[断点前缀]-last在指定断点排在最后面
.order-[断点前缀]-[n]在指定断点排在第 n 位

使用示例

\<!DOCTYPE html>

\<html lang="zh-CN">

\<head>

&#x20; \<meta charset="UTF-8">

&#x20; \<meta name="viewport" content="width=device-width, initial-scale=1.0">

&#x20; \<title>框架示例\</title>

&#x20; \<link rel="stylesheet" href="path/to/enhanced-css-framework.css">

\</head>

\<body class="bg-background">

&#x20; \<div class="container">

&#x20;   \<div class="row">

&#x20;     \<div class="col-md-6">

&#x20;       \<!-- 内容 -->

&#x20;     \</div>

&#x20;     \<div class="col-md-6">

&#x20;       \<!-- 内容 -->

&#x20;     \</div>

&#x20;   \</div>

&#x20; \</div>

\</body>

\</html>
7

5. 工具类

框架提供了丰富的工具类,用于快速设置元素样式,避免重复编写 CSS。

5.1 显示控制

类名说明
.hidden隐藏元素(display: none)
.invisible不可见但保留空间(visibility: hidden)
.visible可见(visibility: visible)
.sr-only仅屏幕阅读器可见
.d-none不显示
.d-block块级显示
.d-flexFlex 布局显示
.d-sm-none在 sm 断点及以上不显示
.d-sm-block在 sm 断点及以上块级显示
.d-sm-flex在 sm 断点及以上 Flex 显示
...类似的 md/lg/xl/xxl 前缀类

使用示例

\<!DOCTYPE html>

\<html lang="zh-CN">

\<head>

&#x20; \<meta charset="UTF-8">

&#x20; \<meta name="viewport" content="width=device-width, initial-scale=1.0">

&#x20; \<title>框架示例\</title>

&#x20; \<link rel="stylesheet" href="path/to/enhanced-css-framework.css">

\</head>

\<body class="bg-background">

&#x20; \<div class="container">

&#x20;   \<div class="row">

&#x20;     \<div class="col-md-6">

&#x20;       \<!-- 内容 -->

&#x20;     \</div>

&#x20;     \<div class="col-md-6">

&#x20;       \<!-- 内容 -->

&#x20;     \</div>

&#x20;   \</div>

&#x20; \</div>

\</body>

\</html>
8

5.2 布局工具

Flex 布局工具

类名说明
.flex启用 Flex 布局
.inline-flex启用内联 Flex 布局
.flex-row水平方向排列(默认)
.flex-row-reverse水平反向排列
.flex-col垂直方向排列
.flex-col-reverse垂直反向排列
.flex-wrap允许换行
.flex-nowrap不允许换行
.justify-start主轴起点对齐
.justify-end主轴终点对齐
.justify-center主轴居中对齐
.justify-between主轴两端对齐
.justify-around主轴均匀分布
.items-start交叉轴起点对齐
.items-end交叉轴终点对齐
.items-center交叉轴居中对齐
.items-baseline交叉轴基线对齐
.items-stretch交叉轴拉伸对齐
.flex-1Flex 项目占满剩余空间
.flex-autoFlex 项目自动调整
.flex-noneFlex 项目不伸缩

使用示例

\<!DOCTYPE html>

\<html lang="zh-CN">

\<head>

&#x20; \<meta charset="UTF-8">

&#x20; \<meta name="viewport" content="width=device-width, initial-scale=1.0">

&#x20; \<title>框架示例\</title>

&#x20; \<link rel="stylesheet" href="path/to/enhanced-css-framework.css">

\</head>

\<body class="bg-background">

&#x20; \<div class="container">

&#x20;   \<div class="row">

&#x20;     \<div class="col-md-6">

&#x20;       \<!-- 内容 -->

&#x20;     \</div>

&#x20;     \<div class="col-md-6">

&#x20;       \<!-- 内容 -->

&#x20;     \</div>

&#x20;   \</div>

&#x20; \</div>

\</body>

\</html>
9

Grid 布局工具

类名说明
.grid启用 Grid 布局
.grid-cols-22 列网格
.grid-cols-33 列网格
.grid-cols-44 列网格
.grid-cols-auto自动列数
.gap-0.gap-2xl网格间距

使用示例

\--color-primary: #007BFF;              /\* 主色调 \*/

\--color-primary-light: #3395FF;        /\* 主色浅变体 \*/

\--color-primary-dark: #0056D2;         /\* 主色深变体 \*/

\--color-primary-transparent: rgba(0, 123, 255, 0.15); /\* 主色透明变体 \*/

\--color-primary-rgb: 0, 123, 255;      /\* 主色RGB值(用于rgba计算) \*/

\--color-secondary: #444;               /\* 辅助色 \*/

\--color-secondary-light: #666;

\--color-secondary-dark: #222;
0

定位工具

类名说明
.position-static静态定位
.position-relative相对定位
.position-absolute绝对定位
.position-fixed固定定位
.position-sticky粘性定位
.top-0顶部对齐
.right-0右侧对齐
.bottom-0底部对齐
.left-0左侧对齐

5.3 间距工具

间距工具类用于快速设置元素的外边距(margin)和内边距(padding),命名规则如下:

  • 前缀:m-(margin)或 p-(padding)
  • 方向:无方向(全方向)、t(上)、b(下)、l(左)、r(右)、x(左右)、y(上下)
  • 大小:0xxsxssmmdlgxl2xl

常用间距类

类名说明
.m-0全方向外边距为 0
.p-md全方向内边距为 md(10px)
.mt-sm上外边距为 sm(5px)
.mb-lg下外边距为 lg(20px)
.px-xl左右内边距为 xl(25px)
.py-2xl上下内边距为 2xl(32px)

使用示例

\--color-primary: #007BFF;              /\* 主色调 \*/

\--color-primary-light: #3395FF;        /\* 主色浅变体 \*/

\--color-primary-dark: #0056D2;         /\* 主色深变体 \*/

\--color-primary-transparent: rgba(0, 123, 255, 0.15); /\* 主色透明变体 \*/

\--color-primary-rgb: 0, 123, 255;      /\* 主色RGB值(用于rgba计算) \*/

\--color-secondary: #444;               /\* 辅助色 \*/

\--color-secondary-light: #666;

\--color-secondary-dark: #222;
1

5.4 边框工具

类名说明
.border基础边框
.border-0无边框
.border-sm细边框
.border-lg粗边框
.border-dashed虚线边框
.border-primary主色边框
.border-success成功色边框
.border-warning警告色边框
.border-danger危险色边框
.border-t上边框
.border-r右边框
.border-b下边框
.border-l左边框
.border-t-0无上边框
...类似的 r-0/b-0/l-0

圆角工具

类名说明
.rounded基础圆角
.rounded-0无圆角
.rounded-sm小圆角
.rounded-lg大圆角化
.rounded-xl超大圆角
.rounded-full全圆角(圆形)
.rounded-t上圆角
.rounded-r右圆角
.rounded-b下圆角
.rounded-l左圆角

使用示例

\--color-primary: #007BFF;              /\* 主色调 \*/

\--color-primary-light: #3395FF;        /\* 主色浅变体 \*/

\--color-primary-dark: #0056D2;         /\* 主色深变体 \*/

\--color-primary-transparent: rgba(0, 123, 255, 0.15); /\* 主色透明变体 \*/

\--color-primary-rgb: 0, 123, 255;      /\* 主色RGB值(用于rgba计算) \*/

\--color-secondary: #444;               /\* 辅助色 \*/

\--color-secondary-light: #666;

\--color-secondary-dark: #222;
2

5.5 文本工具

文本对齐

类名说明
.text-left左对齐
.text-center居中对齐
.text-right右对齐
.text-justify两端对齐

文本颜色

类名说明
.text-primary主色文本
.text-secondary辅助色文本
.text-text主要文本色
.text-text-light浅色文本
.text-muted次要文本
.text-disabled禁用文本色
.text-inverse反色文本(用于深色背景)
.text-success成功色文本
.text-warning警告色文本
.text-danger危险色文本
.text-info信息色文本

文本大小

类名说明对应变量
.text-xs超小文本--font-size-xs (10px)
.text-sm小文本--font-size-sm (12px)
.text-md中等文本--font-size-md (13px)
.text-lg大文本--font-size-lg (14px)
.text-xl超大文本--font-size-xl (16px)
.text-2xl.text-5xl更大文本对应变量逐步增大

字体权重

类名说明对应变量
.font-light轻量--font-weight-light (300)
.font-normal正常--font-weight-normal (400)
.font-medium中等--font-weight-medium (500)
.font-semibold半粗体--font-weight-semibold (600)
.font-bold粗体--font-weight-bold (700)
.font-extrabold特粗体--font-weight-extrabold (800)

其他文本工具

类名说明
.text-underline下划线
.text-underline-hoverhover 时显示下划线
.text-no-underline无下划线
.text-uppercase大写
.text-lowercase小写
.text-capitalize首字母大写

使用示例

\--color-primary: #007BFF;              /\* 主色调 \*/

\--color-primary-light: #3395FF;        /\* 主色浅变体 \*/

\--color-primary-dark: #0056D2;         /\* 主色深变体 \*/

\--color-primary-transparent: rgba(0, 123, 255, 0.15); /\* 主色透明变体 \*/

\--color-primary-rgb: 0, 123, 255;      /\* 主色RGB值(用于rgba计算) \*/

\--color-secondary: #444;               /\* 辅助色 \*/

\--color-secondary-light: #666;

\--color-secondary-dark: #222;
3

5.6 背景工具

背景工具类用于快速设置元素的背景色,命名规则为.bg-[颜色名称]

常用背景类

类名说明
.bg-primary主色背景
.bg-primary-light主色浅色背景
.bg-background主要背景色
.bg-background-alt交替背景色
.bg-background-hover悬停背景色
.bg-success成功色背景
.bg-success-bg成功色浅色背景
.bg-warning警告色背景
.bg-warning-bg警告色浅色背景
.bg-danger危险色背景
.bg-danger-bg危险色浅色背景
.bg-neutral-[n]中性色背景(n 为 50-900)

使用示例

\--color-primary: #007BFF;              /\* 主色调 \*/

\--color-primary-light: #3395FF;        /\* 主色浅变体 \*/

\--color-primary-dark: #0056D2;         /\* 主色深变体 \*/

\--color-primary-transparent: rgba(0, 123, 255, 0.15); /\* 主色透明变体 \*/

\--color-primary-rgb: 0, 123, 255;      /\* 主色RGB值(用于rgba计算) \*/

\--color-secondary: #444;               /\* 辅助色 \*/

\--color-secondary-light: #666;

\--color-secondary-dark: #222;
4

5.7 过渡与动画工具

过渡工具

类名说明
.transition基础过渡效果
.transition-none无过渡
.transition-fast快速过渡(150ms)
.transition-normal正常过渡(300ms)
.transition-slow慢速过渡(500ms)
.transition-color仅颜色过渡
.transition-bg仅背景色过渡
.transition-border仅边框过渡
.transition-transform仅变换过渡
.transition-shadow仅阴影过渡

动画工具

类名说明
.animate-fade-in淡入动画
.animate-fade-out淡出动画
.animate-slide-up上滑动画
.animate-slide-down下滑动画
.animate-slide-left左滑动画
.animate-slide-right右滑动画
.animate-bounce弹跳动画
.animate-pulse脉冲动画
.animate-shake抖动动画
.animate-spin旋转动画
.animate-zoom-in放大动画
.animate-zoom-out缩小动画

使用示例

\--color-primary: #007BFF;              /\* 主色调 \*/

\--color-primary-light: #3395FF;        /\* 主色浅变体 \*/

\--color-primary-dark: #0056D2;         /\* 主色深变体 \*/

\--color-primary-transparent: rgba(0, 123, 255, 0.15); /\* 主色透明变体 \*/

\--color-primary-rgb: 0, 123, 255;      /\* 主色RGB值(用于rgba计算) \*/

\--color-secondary: #444;               /\* 辅助色 \*/

\--color-secondary-light: #666;

\--color-secondary-dark: #222;
5

5.8 其他工具

类名说明
.shadow基础阴影
.shadow-sm小阴影
.shadow-lg大阴影
.shadow-xl超大阴影
.shadow-primary主色阴影
.shadow-hoverhover 时显示更大阴影
.w-100宽度 100%
.h-100高度 100%
.w-auto宽度自动
.h-auto高度自动
.max-w-100最大宽度 100%
.overflow-hidden溢出隐藏
.overflow-auto溢出自动滚动
.cursor-pointer鼠标指针为手型
.cursor-not-allowed鼠标指针为禁止
.opacity-0透明度 0
.opacity-50透明度 50%
.opacity-100透明度 100%
.zoom-hoverhover 时轻微放大

使用示例

\--color-primary: #007BFF;              /\* 主色调 \*/

\--color-primary-light: #3395FF;        /\* 主色浅变体 \*/

\--color-primary-dark: #0056D2;         /\* 主色深变体 \*/

\--color-primary-transparent: rgba(0, 123, 255, 0.15); /\* 主色透明变体 \*/

\--color-primary-rgb: 0, 123, 255;      /\* 主色RGB值(用于rgba计算) \*/

\--color-secondary: #444;               /\* 辅助色 \*/

\--color-secondary-light: #666;

\--color-secondary-dark: #222;
6

6. 示例

6.1 基础布局示例

\--color-primary: #007BFF;              /\* 主色调 \*/

\--color-primary-light: #3395FF;        /\* 主色浅变体 \*/

\--color-primary-dark: #0056D2;         /\* 主色深变体 \*/

\--color-primary-transparent: rgba(0, 123, 255, 0.15); /\* 主色透明变体 \*/

\--color-primary-rgb: 0, 123, 255;      /\* 主色RGB值(用于rgba计算) \*/

\--color-secondary: #444;               /\* 辅助色 \*/

\--color-secondary-light: #666;

\--color-secondary-dark: #222;
7

6.2 响应式布局示例

\--color-primary: #007BFF;              /\* 主色调 \*/

\--color-primary-light: #3395FF;        /\* 主色浅变体 \*/

\--color-primary-dark: #0056D2;         /\* 主色深变体 \*/

\--color-primary-transparent: rgba(0, 123, 255, 0.15); /\* 主色透明变体 \*/

\--color-primary-rgb: 0, 123, 255;      /\* 主色RGB值(用于rgba计算) \*/

\--color-secondary: #444;               /\* 辅助色 \*/

\--color-secondary-light: #666;

\--color-secondary-dark: #222;
8

6.3 组件样式示例

按钮组件

\--color-primary: #007BFF;              /\* 主色调 \*/

\--color-primary-light: #3395FF;        /\* 主色浅变体 \*/

\--color-primary-dark: #0056D2;         /\* 主色深变体 \*/

\--color-primary-transparent: rgba(0, 123, 255, 0.15); /\* 主色透明变体 \*/

\--color-primary-rgb: 0, 123, 255;      /\* 主色RGB值(用于rgba计算) \*/

\--color-secondary: #444;               /\* 辅助色 \*/

\--color-secondary-light: #666;

\--color-secondary-dark: #222;
9

表单组件

\--color-background: #ffffff;           /\* 主要背景色 \*/

\--color-background-alt: #f9fafb;       /\* 交替背景色 \*/

\--color-background-hover: #f3f4f6;     /\* 悬停背景色 \*/

\--color-background-active: #e5e7eb;    /\* 激活背景色 \*/

\--color-background-card: #ffffff;      /\* 卡片背景色 \*/

\--color-background-modal: #ffffff;     /\* 模态框背景色 \*/

\--color-background-overlay: rgba(0, 0, 0, 0.5); /\* 遮罩层背景色 \*/
0

提示框组件

\--color-background: #ffffff;           /\* 主要背景色 \*/

\--color-background-alt: #f9fafb;       /\* 交替背景色 \*/

\--color-background-hover: #f3f4f6;     /\* 悬停背景色 \*/

\--color-background-active: #e5e7eb;    /\* 激活背景色 \*/

\--color-background-card: #ffffff;      /\* 卡片背景色 \*/

\--color-background-modal: #ffffff;     /\* 模态框背景色 \*/

\--color-background-overlay: rgba(0, 0, 0, 0.5); /\* 遮罩层背景色 \*/
1

以上就是增强版 CSS 框架的详细使用文档。通过灵活运用框架提供的网格系统和工具类,可以快速构建出美观、一致且响应式的网页界面。如需进一步定制,可以通过修改全局变量来调整主题样式,无需修改工具类代码。

(注:文档部分内容可能由 AI 生成)