融合未来感与高级质感的图文并茂网页,采用现代Web技术实现丰富的交互体验与视觉层次
在数码纪元数字货币市场动态与投资教育综合平台的整体设计中,深色背景营造出浓厚的科技氛围。主色调选择深蓝色,通过linear-gradient实现渐变效果,搭配荧光蓝和紫色的点缀,赋予页面未来感与动感。
body {
background: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
color: #ffffff;
font-family: 'Roboto', sans-serif;
}
.accent {
color: #00ffff;
}
顶部导航栏通过position: fixed固定在页面顶部,确保用户在浏览过程中始终可访问主要选项。导航栏的背景色采用半透明设计,结合transition属性,实现平滑的用户体验。
.navbar {
position: fixed;
top: 0;
width: 100%;
background: rgba(0, 0, 0, 0.7);
display: flex;
justify-content: space-around;
padding: 15px 0;
transition: background 0.3s ease;
}
.navbar a:hover {
color: #ff8c00;
}
侧边栏采用垂直选项卡布局,利用flexbox实现灵活的内容排列。通过媒体查询,确保在不同设备上侧边栏的可访问性和美观性。
.sidebar {
display: flex;
flex-direction: column;
width: 200px;
background-color: #1a1a1a;
height: 100vh;
position: fixed;
left: 0;
top: 60px;
padding-top: 20px;
}
.sidebar a {
padding: 15px;
text-decoration: none;
color: #ffffff;
transition: background 0.3s;
}
@media (max-width: 768px) {
.sidebar {
width: 100%;
height: auto;
position: relative;
}
}
市场行情和新闻资讯部分采用CSS Grid布局,确保内容的清晰有序。卡片式设计通过阴影与边框,突出信息层次,使用户一目了然。
.grid-container {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 20px;
padding: 80px 20px 20px 220px;
}
.card {
background-color: #2c3e50;
border: 1px solid #34495e;
border-radius: 8px;
padding: 20px;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
transition: transform 0.3s, box-shadow 0.3s;
}
插画元素如旋转的数字货币图标,通过@keyframes实现持续旋转动画,增强页面的动态感。背景中的抽象数字图案使用background-image结合渐变色,提升整体视觉层次。
.rotating-icon {
animation: rotate 10s linear infinite;
}
@keyframes rotate {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
.background-pattern {
background-image: linear-gradient(45deg, #0f2027, #203a43, #2c5364);
opacity: 0.1;
}
通过CSS变量定义不同主题的颜色方案,用户可在浅色模式、深色模式和炫彩模式间自由切换。利用transition属性,实现主题切换时的平滑过渡,提升用户体验。
:root {
--background-color: #0f2027;
--primary-color: #203a43;
--accent-color: #00ffff;
--highlight-color: #ff8c00;
}
.light-theme {
--background-color: #ffffff;
--primary-color: #f0f0f0;
--accent-color: #007BFF;
--highlight-color: #ff8c00;
}
body {
background-color: var(--background-color);
transition: background-color 0.3s, color 0.3s;
}
使用现代易读的Roboto字体,提高文字的可读性。标题部分采用更为醒目的字体权重,确保信息层次分明。通过line-height和letter-spacing优化排版,让内容更加舒适易读。
body {
font-family: 'Roboto', sans-serif;
line-height: 1.6;
letter-spacing: 0.5px;
}
h2, h3 {
font-weight: 700;
margin-bottom: 15px;
}
通过@media查询和灵活的布局设计,网页在移动设备上同样展现出色。PWA特性确保用户即便在离线状态下,也能顺畅访问已缓存的内容,提升使用便捷性。
@media (max-width: 600px) {
.grid-container {
padding: 80px 10px 10px 10px;
grid-template-columns: 1fr;
}
.sidebar {
display: none;
}
}
.offline-banner {
position: fixed;
bottom: 0;
width: 100%;
background-color: #ff8c00;
color: #ffffff;
text-align: center;
padding: 10px 0;
display: none;
}