数字货币与加密资产交易平台
现代化卡片式设计体验,融合前沿科技与视觉美学,打造沉浸式交易环境。
视觉与色彩设计
整体网页采用深蓝色与黑色为主色调,通过亮橙色和蓝绿色点缀关键元素,营造出专业且充满活力的视觉氛围。色彩的搭配不仅提升了页面的现代感,还增强了用户的视觉体验。
body {
background-color: #0d1b2a;
color: #ffffff;
font-family: 'Roboto', sans-serif;
}
.primary-color {
color: #ff8c00; /* 亮橙色 */
}
.accent-color {
color: #00ced1; /* 蓝绿色 */
}
顶部导航栏的固定实现
顶部导航栏采用固定定位,确保在用户滚动页面时始终可见。通过白色和灰色文字提升选项的可读性,同时使用CSS3的flexbox布局实现主菜单的横向排列。
.navbar {
position: fixed;
top: 0;
width: 100%;
background-color: #1b263b;
display: flex;
justify-content: space-around;
align-items: center;
padding: 1rem 0;
z-index: 1000;
}
.navbar a {
color: #dbe2ef;
text-decoration: none;
font-weight: 500;
}
.navbar a:hover {
color: #ff8c00;
}
网格卡片式布局
首页采用网格布局,左侧展示主信息流,如行情动态和实时新闻,右侧为快捷操作区域,包括登录状态和个性化推荐。CSS3的grid系统使得布局灵活且响应迅速。
.container {
display: grid;
grid-template-columns: 3fr 1fr;
gap: 1.5rem;
padding: 5rem 2rem 2rem 2rem;
}
卡片的交互效果
卡片设计采用圆角矩形和轻微的阴影效果,在用户悬停时通过transform属性实现放大动画,点击后使用transition平滑过渡到详细页面。
.card {
background-color: #1b263b;
border-radius: 12px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
transition: transform 0.3s ease, box-shadow 0.3s ease;
padding: 1rem;
}
.card:hover {
transform: scale(1.05);
box-shadow: 0 8px 12px rgba(0, 0, 0, 0.2);
}
.card:active {
transform: scale(1);
transition: transform 0.2s ease;
}
数据可视化模块的CSS3实现
页面中部集成动态图表模块,展示K线图和成交量变化。通过CSS3的flexbox和grid布局,实现响应式设计,支持用户自定义时间范围和参数选择。
.chart-container {
display: flex;
flex-direction: column;
background-color: #1b263b;
padding: 2rem;
border-radius: 12px;
}
.chart-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 1rem;
}
.chart-content {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 1rem;
}
扁平化图标与字体选择
引入扁平化插画风格图标,统一字体为Roboto Bold用于标题,Roboto Regular用于正文内容,确保整体的一致性与美观性。CSS3的@font-face规则实现自定义字体加载。
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');
h2, h3 {
font-family: 'Roboto', sans-serif;
font-weight: 700;
}
p, span, a {
font-family: 'Roboto', sans-serif;
font-weight: 400;
}
.icon {
width: 24px;
height: 24px;
fill: #ffffff;
}
骨架屏加载动画
使用骨架屏技术在资源未完全加载前显示占位符,提升用户体验。通过CSS3的@keyframes定义动画,实现流畅的过渡效果。
.skeleton {
background-color: #1b263b;
border-radius: 12px;
position: relative;
overflow: hidden;
}
.skeleton::after {
content: '';
position: absolute;
top: 0;
left: -100%;
height: 100%;
width: 100%;
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
animation: loading 1.5s infinite;
}
@keyframes loading {
0% {
left: -100%;
}
100% {
left: 100%;
}
}
响应式设计与媒体查询
为了适配不同设备,采用媒体查询优化布局。通过@media规则调整网格布局和卡片尺寸,确保在移动端也能获得良好的用户体验。
@media (max-width: 768px) {
.container {
grid-template-columns: 1fr;
padding: 3rem 1rem 1rem 1rem;
}
.chart-content {
grid-template-columns: 1fr;
}
}
动效与过渡的应用
动效不仅提升视觉效果,还增强了用户的交互体验。通过transition和transform属性,实现按钮点击、卡片悬停等各种流畅的动画效果。
.button {
background-color: #00ced1;
color: #0d1b2a;
padding: 0.75rem 1.5rem;
border: none;
border-radius: 8px;
cursor: pointer;
transition: background-color 0.3s ease, transform 0.3s ease;
}
.button:hover {
background-color: #ff8c00;
transform: translateY(-2px);
}
.button:active {
transform: translateY(0);
}
总结
通过运用CSS3的先进技术,如flexbox、grid、transitions和动画,成功打造出一个兼具美观与功能性的数字货币与加密资产交易平台。精心设计的色彩搭配、响应式布局以及细腻的动效交互,使用户在操作过程中享受到流畅且富有科技感的体验。