【无标题】

body { font-family: 'Arial', sans-serif; } /* 全局样式 /
.container { max-width: 1200px; margin: 0 auto; } /
类选择器 /
#header { background: #333; color: white; } /
ID选择器 */

inputtype="email" { border: 1px solid #ccc; } /* 精确匹配属性 /
ahref\^="https"::after { content: "↗"; } /
属性以"https"开头 */

button:hover { background: #4CAF50; } /* 鼠标悬停状态 /
p::first-line { font-weight: bold; } /
首行样式 */

.card {

width: 100%;

max-width: 400px;

padding: clamp(1rem, 5vw, 2rem); /* 动态调整间距 */

}

  1. CSS布局技术

.flex-container {

display: flex;

justify-content: space-between; /* 水平分布 /
align-items: center; /
垂直对齐 /
gap: 20px; /
间距 */

}

.grid-container {

display: grid;

grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); /* 响应式列 /
grid-gap: 15px; /
网格间距 */

}

.modal {

position: fixed; /* 固定定位 /
top: 50%;
left: 50%;
transform: translate(-50%, -50%); /
居中 /
z-index: 1000; /
层级控制 */

}

@keyframes fadeIn {

from { opacity: 0; transform: translateY(20px); }

to { opacity: 1; transform: translateY(0); }

}

.animate-element {

animation: fadeIn 0.5s ease-out forwards; /* 动画效果 */

}

.button {

transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); /* 平滑过渡 /
}
.button:active {
transform: scale(0.98); /
点击效果 */

}

.flex-center {

display: flex;

justify-content: center; /* 水平居中 /
align-items: center; /
垂直居中 /
height: 100vh; /
撑满视口高度 */

}

.grid-center {

display: grid;

place-items: center; /* 同时控制水平和垂直 */

height: 100vh;

}

.table-center {

display: table;

width: 100%;

height: 100vh;

}

.table-cell {

display: table-cell;

text-align: center; /* 水平居中 /
vertical-align: middle; /
垂直居中 */

}

.abs-center {

position: absolute;

top: 50%;

left: 50%;

margin-top: -50px; /* 高度的一半 /
margin-left: -50px; /
宽度的一半 */

width: 100px;

height: 100px;

}

.calc-center {

position: absolute;

top: calc(50% - 25px); /* 50%减去自身高度一半 /
left: calc(50% - 50px); /
50%减去自身宽度一半 */

width: 100px;

height: 50px;

}

.viewport-center {

position: absolute;

top: 50vh; /* 视口高度50% /
left: 50vw; /
视口宽度50% */

transform: translate(-50%, -50%);

}

.auto-margin {

display: flex;

width: 100vw;

height: 100vh;

}

.child {

margin: auto; /* 自动占满剩余空间 */

}

.text-center {

text-align: center; /* 水平居中 /
line-height: 3em; /
垂直居中(需已知容器高度) /
height: 3em;
}
/
或使用Flexbox */

.text-center {

display: flex;

align-items: center;

justify-content: center;

}

.frosted-glass {

background: rgba(255,255,255,0.2);

backdrop-filter: blur(10px); /* 背景模糊 */

border: 1px solid rgba(255,255,255,0.1);

}

::-webkit-scrollbar {

width: 8px; /* 滚动条宽度 /
}
::-webkit-scrollbar-track {
background: #f1f1f1; /
轨道背景 /
}
::-webkit-scrollbar-thumb {
background: #888; /
滚动条颜色 /
border-radius: 4px; /
圆角 */

}

相关推荐
骑着蜗牛撵大象32727 分钟前
豆包 Seed 驱动的记账智能体:从拍票抽取到月报生成的全链路落地记录
java·前端·javascript·结构化输出·豆包seed·多模态识别·记账系统
溪语流沙28 分钟前
【Web全栈进阶】前端世界观:现代工具链与框架为什么存在
前端·javascript·vue.js
kyriewen1 小时前
我逐个测了 JSON.stringify 的 7 个坑:第 1 个就在丢数据
前端·javascript·程序员
积流成海1 小时前
用代码实现哈希计算器:Web Crypto API 实战
前端·算法·哈希算法·哈希函数·盘子工具站
data analyse 4561 小时前
服务端访问日志聚合 PV 与 UV 怎么实现?日志采集与口径设计
大数据·前端·数据分析
JavaGuide1 小时前
DeepSeek Harness 重磅更新,Codex、Claude Code 子智能体进官方插件列表了,还有 Git 工作树和思考翻译!
前端·后端
小羊没烦恼!2 小时前
OS X 上使用.NET开发应用程序
开发语言·前端·数据库·人工智能·c#·策略模式
Eiceblue3 小时前
使用 Python 实现 Excel 行列转置(保留单元格样式)
前端·python·excel
西西学代码3 小时前
像素和颜色之间的转换(Flutter)
前端·javascript·flutter
茶底世界之下3 小时前
羽毛颜色已经很鲜艳,还要继续加色吗?用 Awaking 试一次减饱和
前端·ios·运营