目录
-
- 专栏导读
- 🎨 设计理念:科技与美学的完美融合
-
- 视觉风格定位
- 字体选择
- 🏗️ 技术架构:现代化前端解决方案
-
- 核心技术栈
- 关键特性
- 🎭 核心功能模块深度剖析
-
- 1. 动态背景系统
- 2. 数字滚动动画
- 3. 渐进式显示系统
- 📱 响应式设计:全设备适配
-
- 断点策略
- 移动端优化
- 🎯 用户体验设计
-
- 导航系统
- 交互细节
- 🚀 性能优化策略
-
- 1. 资源优化
- 2. 动画性能
- 3. 渲染优化
- 📊 项目结构与扩展性
-
- 组件化思维
- 🎨 设计系统:可维护的视觉规范
-
- CSS自定义属性
- 🌟 亮点功能详解
-
- 1. NebulaTech品牌标识
- 2. 合作伙伴无缝轮播
- 🔮 未来扩展方向
-
- 1. 技术升级路径
- 2. 功能增强
- 3. 性能优化
- 💡 开发心得与最佳实践
-
- 1. 渐进式开发
- 2. 性能优先
- 3. 用户中心
- 4. 代码质量
- 源代码
-
- index.html
- scripts.js
- styles.css
- 🎊 总结
专栏导读
-
🌸 欢迎来到Python办公自动化专栏—Python处理办公问题,解放您的双手
-
🏳️🌈 博客主页:请点击——> 一晌小贪欢的博客主页求关注
-
👍 该系列文章专栏:请点击——>Python办公自动化专栏求订阅
-
🕷 此外还有爬虫专栏:请点击——>Python爬虫基础专栏求订阅
-
📕 此外还有python基础专栏:请点击——>Python基础学习专栏求订阅
-
文章作者技术和水平有限,如果文中出现错误,希望大家能指正🙏
-
❤️ 欢迎各位佬关注! ❤️
-
在当今数字化时代,一个出色的公司首页不仅是企业形象的门面,更是吸引客户、展示实力的重要窗口。本文将深入解析如何构建一个现代化的科技风公司首页,从视觉设计到交互体验,每一个细节都体现着前沿科技的魅力。
🎨 设计理念:科技与美学的完美融合
视觉风格定位
我们采用了深空蓝(#0B1020)作为主背景色,营造出深邃的科技感。配色方案围绕两个核心颜色展开:
- 主色调:紫罗兰(#7C3AED) – 象征创新与未来
- 辅助色:青蓝色(#00F5FF) – 代表科技与活力
这种配色不仅符合科技公司的品牌调性,更能在视觉上形成强烈的科技感冲击。
字体选择
- 品牌标识:Orbitron – 未来感十足的等宽字体
- 正文内容:Inter – 现代简洁的无衬线字体
- 中文适配:PingFang SC、Microsoft YaHei
🏗️ 技术架构:现代化前端解决方案
核心技术栈
HTML5 + CSS3 + Vanilla JavaScript
├── 语义化标签结构
├── CSS Grid + Flexbox 布局
├── CSS Variables 主题系统
├── Canvas 动画引擎
└── 响应式设计
关键特性
🎭 核心功能模块深度剖析
1. 动态背景系统
function drawGrid(){
// 透视网格绘制
const baseY = H*0.65;
const gridSize = 26;
// 横向流动线条
for(let i=–40;i<60;i++){
const off = (i*gridSize + (t*22)%gridSize);
ctx.moveTo(0, baseY + off);
ctx.lineTo(W, baseY + off);
ctx.stroke();
}
// 纵向透视线条
for(let i=0;i<=cols;i++){
const x = (i/cols)*W;
ctx.moveTo(x, baseY–140);
ctx.lineTo(x + (i – cols/2)*6, H);
ctx.stroke();
}
}
这个背景系统实现了:
- 透视网格:模拟3D空间深度感
- 流星粒子:140个随机分布的发光点
- 扫描线效果:循环移动的高亮线条
- 径向光晕:中心发散的光效
2. 数字滚动动画
function animateCount(el){
const target = +el.dataset.count || 0;
const duration = 1200;
// 使用easeOutQuart缓动函数
function tick(now){
const p = Math.min((now – start)/duration, 1);
const eased = p<0.5? 2*p*p : 1 – Math.pow(–2*p+2,2)/2;
el.textContent = Math.floor(target * (0.15 + 0.85 * eased));
}
}
3. 渐进式显示系统
.reveal{
opacity:0;
transform:translateY(18px);
animation:reveal .8s ease forwards;
animation-delay:var(–d, 0s)
}
通过CSS变量控制每个元素的出现时机,创造层次感。
📱 响应式设计:全设备适配
断点策略
/* 大屏优先设计 */
@media (max-width: 1024px){
.cards{grid-template-columns:repeat(2, 1fr)}
}
@media (max-width: 640px){
.nav{
position:fixed;
transform:translateY(-120%);
transition:transform .25s ease
}
.cards{grid-template-columns:1fr}
}
移动端优化
- 汉堡菜单:小屏设备下的导航解决方案
- 触摸友好:按钮尺寸符合移动端点击习惯
- 性能优化:限制动画复杂度,确保流畅体验
🎯 用户体验设计
导航系统
- 粘性导航:position: sticky 确保导航始终可见
- 平滑滚动:锚点跳转配合 scroll-behavior: smooth
- 视觉反馈:悬停状态的微妙动画
交互细节
🚀 性能优化策略
1. 资源优化
- 字体预加载:<link rel="preconnect"> 减少字体加载延迟
- 图标矢量化:全SVG图标,可缩放且体积小
- CSS压缩:去除空格和注释,减小文件体积
2. 动画性能
// 限制设备像素比,避免高分屏过度渲染
const dpr = Math.min(window.devicePixelRatio || 1, 2);
// 使用requestAnimationFrame确保60fps
function loop(){
t += 0.016;
drawGrid();
requestAnimationFrame(loop);
}
3. 渲染优化
- GPU加速:transform3d() 触发硬件加速
- will-change:提前告知浏览器哪些属性会变化
- 层叠上下文:合理使用z-index避免重绘
📊 项目结构与扩展性
NebulaTech-Homepage/
├── index.html # 主页面结构
├── styles.css # 样式系统
├── script.js # 交互逻辑
└── README.md # 项目文档
组件化思维
虽然使用原生技术,但代码结构采用组件化思维:
- Header组件:导航与品牌标识
- Hero组件:主视觉区域
- Services组件:能力展示卡片
- Solutions组件:行业解决方案
- Partners组件:合作伙伴轮播
- Footer组件:页脚信息
🎨 设计系统:可维护的视觉规范
CSS自定义属性
:root{
–bg:#0B1020;
–primary:#7C3AED;
–cyan:#00F5FF;
–text:#E5E7EB;
–muted:#9CA3AF;
–glass:rgba(255,255,255,0.06);
–border:rgba(255,255,255,0.12);
–shadow:0 10px 30px rgba(0,0,0,.4);
}
这套设计令牌系统确保了:
- 一致性:全站统一的色彩语言
- 可维护性:修改一个值影响全局
- 主题切换:为未来的多主题支持做准备
🌟 亮点功能详解
1. NebulaTech品牌标识
<svg width="28" height="28" viewBox="0 0 64 64">
<defs>
<linearGradient id="g-logo">
<stop offset="0%" stop-color="#00F5FF"/>
<stop offset="100%" stop-color="#7C3AED"/>
</linearGradient>
</defs>
<circle cx="32" cy="32" r="28" fill="none" stroke="url(#g-logo)"/>
<path d="M16 40 C22 20, 42 20, 48 40" fill="none" stroke="url(#g-logo)"/>
</svg>
自定义的SVG logo融合了:
- 渐变描边:体现品牌的科技属性
- 抽象几何:现代简约的视觉语言
- 发光效果:增强科技感
2. 合作伙伴无缝轮播
.track{
display:flex;
gap:20px;
width:max-content;
animation:scroll 40s linear infinite
}
通过复制内容实现无缝循环,避免了JavaScript的复杂逻辑。
🔮 未来扩展方向
1. 技术升级路径
- TypeScript改造:增强代码类型安全
- 模块化重构:ES6模块化拆分组件
- 构建工具引入:Vite/Webpack优化开发体验
- PWA支持:离线访问与安装能力
2. 功能增强
- 多语言支持:国际化方案
- 主题切换:明暗模式切换
- 数据可视化:Chart.js集成实时数据
- 3D效果:Three.js增强视觉冲击
3. 性能优化
- 图片懒加载:Intersection Observer API
- 代码分割:按需加载减少初始包体积
- CDN部署:全球加速访问体验
- 缓存策略:Service Worker离线缓存
💡 开发心得与最佳实践
1. 渐进式开发
-
从基础的HTML结构开始,逐步添加样式和交互,确保每个阶段都是可用的产品。
2. 性能优先
-
在视觉效果和性能之间找到平衡点,优先保证核心功能的流畅体验。
3. 用户中心
-
始终从用户角度思考,每个动画和交互都应该为提升用户体验服务。
4. 代码质量
- 语义化HTML:提升可访问性和SEO友好度
- BEM命名规范:CSS类名的一致性维护
- 注释完善:为未来的维护者考虑
源代码
index.html
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>NebulaTech · 科技风公司首页</title>
<meta name="description" content="NebulaTech — 点亮未来的数字引擎,提供云原生、AI赋能、数据中台等数字化转型整体方案。" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700;800&family=Orbitron:wght@500;700&display=swap" rel="stylesheet" />
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<header class="site-header">
<div class="container header-inner">
<a href="#hero" class="logo" aria-label="NebulaTech">
<svg width="28" height="28" viewBox="0 0 64 64" aria-hidden="true" class="logo-mark">
<defs>
<linearGradient id="g-logo" x1="0" y1="0" x2="1" y2="1">
<stop offset="0%" stop-color="#00F5FF"/>
<stop offset="100%" stop-color="#7C3AED"/>
</linearGradient>
</defs>
<circle cx="32" cy="32" r="28" fill="none" stroke="url(#g-logo)" stroke-width="2.5"/>
<path d="M16 40 C22 20, 42 20, 48 40" fill="none" stroke="url(#g-logo)" stroke-width="3" stroke-linecap="round"/>
<circle cx="22" cy="24" r="3" fill="#00F5FF"/>
<circle cx="42" cy="24" r="3" fill="#7C3AED"/>
</svg>
<span class="logo-text">NebulaTech</span>
</a>
<nav class="nav" aria-label="主导航">
<a href="#hero">首页</a>
<a href="#services">能力</a>
<a href="#solutions">方案</a>
<a href="#partners">合作</a>
<a href="#contact" class="btn btn-primary">联系我们</a>
</nav>
<button class="nav-toggle" aria-label="打开菜单" aria-expanded="false">
<span></span><span></span><span></span>
</button>
</div>
</header>
<main>
<section id="hero" class="hero">
<canvas id="fx" aria-hidden="true"></canvas>
<div class="container hero-inner">
<h1 class="neon-text reveal">点亮未来的数字引擎</h1>
<p class="sub reveal" style="–d:0.07s">云原生 · AI 赋能 · 数据智能,一站式打造企业数字化增长飞轮</p>
<div class="cta reveal" style="–d:0.12s">
<a href="#services" class="btn btn-primary">了解方案</a>
<a href="#solutions" class="btn btn-ghost">观看演示</a>
</div>
<ul class="stats">
<li class="reveal" style="–d:0.18s"><span class="num" data-count="98">0</span><span class="label">客户满意度</span></li>
<li class="reveal" style="–d:0.22s"><span class="num" data-count="300">0</span><span class="label">成功案例</span></li>
<li class="reveal" style="–d:0.26s"><span class="num" data-count="24">0</span><span class="label">全球节点</span></li>
</ul>
</div>
</section>
<section id="services" class="section">
<div class="container">
<h2 class="section-title">核心能力</h2>
<div class="grid cards">
<article class="card reveal">
<div class="icon">
<svg viewBox="0 0 64 64" aria-hidden="true"><defs><linearGradient id="g1" x1="0" y1="0" x2="1" y2="1"><stop offset="0%" stop-color="#00F5FF"/><stop offset="100%" stop-color="#7C3AED"/></linearGradient></defs><path d="M12 20h40v24H12z" fill="none" stroke="url(#g1)" stroke-width="2.5"/><path d="M12 28h40" stroke="#00F5FF" stroke-width="2"/><circle cx="20" cy="24" r="2" fill="#00F5FF"/><circle cx="28" cy="24" r="2" fill="#00F5FF"/><circle cx="36" cy="24" r="2" fill="#00F5FF"/></svg>
</div>
<h3>云原生平台</h3>
<p>基于容器与微服务的企业级 PaaS,弹性、安全、可观测。</p>
</article>
<article class="card reveal" style="–d:0.05s">
<div class="icon">
<svg viewBox="0 0 64 64" aria-hidden="true"><defs><linearGradient id="g2" x1="0" y1="0" x2="1" y2="1"><stop offset="0%" stop-color="#00F5FF"/><stop offset="100%" stop-color="#7C3AED"/></linearGradient></defs><circle cx="24" cy="28" r="10" fill="none" stroke="url(#g2)" stroke-width="2.5"/><circle cx="40" cy="36" r="10" fill="none" stroke="url(#g2)" stroke-width="2.5"/><path d="M31 31l2 2" stroke="#00F5FF" stroke-width="2"/></svg>
</div>
<h3>AI 赋能</h3>
<p>从智能客服到AIGC,深度整合大模型与业务流程。</p>
</article>
<article class="card reveal" style="–d:0.1s">
<div class="icon">
<svg viewBox="0 0 64 64" aria-hidden="true"><defs><linearGradient id="g3" x1="0" y1="0" x2="1" y2="1"><stop offset="0%" stop-color="#00F5FF"/><stop offset="100%" stop-color="#7C3AED"/></linearGradient></defs><path d="M12 44l10-16 10 8 10-18 10 26" fill="none" stroke="url(#g3)" stroke-width="2.5" stroke-linecap="round"/></svg>
</div>
<h3>数据中台</h3>
<p>统一的数据资产与治理,实时指标驱动业务决策。</p>
</article>
<article class="card reveal" style="–d:0.15s">
<div class="icon">
<svg viewBox="0 0 64 64" aria-hidden="true"><defs><linearGradient id="g4" x1="0" y1="0" x2="1" y2="1"><stop offset="0%" stop-color="#00F5FF"/><stop offset="100%" stop-color="#7C3AED"/></linearGradient></defs><path d="M16 20h32v8H16zM16 36h32v8H16z" fill="none" stroke="url(#g4)" stroke-width="2.5"/></svg>
</div>
<h3>低代码引擎</h3>
<p>可视化搭建与组件化复用,快速响应市场变化。</p>
</article>
</div>
</div>
</section>
<section id="solutions" class="section alt">
<div class="container">
<h2 class="section-title">行业解决方案</h2>
<div class="grid solutions">
<article class="solution reveal">
<h3>零售 · 全渠道增长</h3>
<ul>
<li>用户360画像与智能推荐</li>
<li>门店数字孪生与库存优化</li>
<li>CDP 构建与营销自动化</li>
</ul>
</article>
<article class="solution reveal" style="–d:0.06s">
<h3>制造 · 智能工厂</h3>
<ul>
<li>设备预测性维护与质量检测</li>
<li>边缘计算与低时延联接</li>
<li>生产可视化与能耗优化</li>
</ul>
</article>
<article class="solution reveal" style="–d:0.12s">
<h3>金融 · 风险控制</h3>
<ul>
<li>反欺诈与信贷风控模型</li>
<li>隐私计算与合规数据流通</li>
<li>实时风控中台与告警</li>
</ul>
</article>
</div>
</div>
</section>
<section id="partners" class="section">
<div class="container">
<h2 class="section-title">生态合作伙伴</h2>
<div class="marquee">
<div class="track">
<div class="brand"> <svg viewBox="0 0 160 40" aria-hidden="true"><rect x="2" y="2" width="156" height="36" rx="10" fill="rgba(124,58,237,0.08)" stroke="#7C3AED"/><text x="80" y="26" text-anchor="middle" fill="#9CA3AF" font-size="16">Alpha</text></svg></div>
<div class="brand"> <svg viewBox="0 0 160 40" aria-hidden="true"><rect x="2" y="2" width="156" height="36" rx="10" fill="rgba(0,245,255,0.08)" stroke="#00F5FF"/><text x="80" y="26" text-anchor="middle" fill="#9CA3AF" font-size="16">Nova</text></svg></div>
<div class="brand"> <svg viewBox="0 0 160 40" aria-hidden="true"><rect x="2" y="2" width="156" height="36" rx="10" fill="rgba(124,58,237,0.08)" stroke="#7C3AED"/><text x="80" y="26" text-anchor="middle" fill="#9CA3AF" font-size="16">Zenith</text></svg></div>
<div class="brand"> <svg viewBox="0 0 160 40" aria-hidden="true"><rect x="2" y="2" width="156" height="36" rx="10" fill="rgba(0,245,255,0.08)" stroke="#00F5FF"/><text x="80" y="26" text-anchor="middle" fill="#9CA3AF" font-size="16">Quanta</text></svg></div>
<div class="brand"> <svg viewBox="0 0 160 40" aria-hidden="true"><rect x="2" y="2" width="156" height="36" rx="10" fill="rgba(124,58,237,0.08)" stroke="#7C3AED"/><text x="80" y="26" text-anchor="middle" fill="#9CA3AF" font-size="16">Orion</text></svg></div>
<!– duplicate for seamless loop –>
<div class="brand"> <svg viewBox="0 0 160 40" aria-hidden="true"><rect x="2" y="2" width="156" height="36" rx="10" fill="rgba(124,58,237,0.08)" stroke="#7C3AED"/><text x="80" y="26" text-anchor="middle" fill="#9CA3AF" font-size="16">Alpha</text></svg></div>
<div class="brand"> <svg viewBox="0 0 160 40" aria-hidden="true"><rect x="2" y="2" width="156" height="36" rx="10" fill="rgba(0,245,255,0.08)" stroke="#00F5FF"/><text x="80" y="26" text-anchor="middle" fill="#9CA3AF" font-size="16">Nova</text></svg></div>
<div class="brand"> <svg viewBox="0 0 160 40" aria-hidden="true"><rect x="2" y="2" width="156" height="36" rx="10" fill="rgba(124,58,237,0.08)" stroke="#7C3AED"/><text x="80" y="26" text-anchor="middle" fill="#9CA3AF" font-size="16">Zenith</text></svg></div>
<div class="brand"> <svg viewBox="0 0 160 40" aria-hidden="true"><rect x="2" y="2" width="156" height="36" rx="10" fill="rgba(0,245,255,0.08)" stroke="#00F5FF"/><text x="80" y="26" text-anchor="middle" fill="#9CA3AF" font-size="16">Quanta</text></svg></div>
<div class="brand"> <svg viewBox="0 0 160 40" aria-hidden="true"><rect x="2" y="2" width="156" height="36" rx="10" fill="rgba(124,58,237,0.08)" stroke="#7C3AED"/><text x="80" y="26" text-anchor="middle" fill="#9CA3AF" font-size="16">Orion</text></svg></div>
</div>
</div>
</div>
</section>
<section id="contact" class="section contact-cta">
<div class="container">
<div class="cta-card reveal">
<h2>准备好加速增长?</h2>
<p>预约 30 分钟免费咨询,获取专属数字化转型路线图。</p>
<a href="#" class="btn btn-primary">预约咨询</a>
</div>
</div>
</section>
</main>
<footer class="site-footer">
<div class="container footer-inner">
<div class="f-brand">
<a class="logo" href="#hero" aria-label="NebulaTech">
<svg width="24" height="24" viewBox="0 0 64 64" aria-hidden="true" class="logo-mark">
<defs>
<linearGradient id="g-logo-f" x1="0" y1="0" x2="1" y2="1">
<stop offset="0%" stop-color="#00F5FF"/>
<stop offset="100%" stop-color="#7C3AED"/>
</linearGradient>
</defs>
<circle cx="32" cy="32" r="28" fill="none" stroke="url(#g-logo-f)" stroke-width="2.5"/>
<path d="M16 40 C22 20, 42 20, 48 40" fill="none" stroke="url(#g-logo-f)" stroke-width="3" stroke-linecap="round"/>
</svg>
<span class="logo-text">NebulaTech</span>
</a>
<p>© <span id="year"></span> NebulaTech. All rights reserved.</p>
</div>
<div class="f-links">
<a href="#services">能力</a>
<a href="#solutions">方案</a>
<a href="#partners">合作</a>
<a href="#contact">联系</a>
</div>
</div>
</footer>
<script src="script.js" defer></script>
</body>
</html>
scripts.js
// 导航切换
const navToggle = document.querySelector('.nav-toggle');
const nav = document.querySelector('.nav');
if (navToggle) {
navToggle.addEventListener('click', () => {
const show = nav.classList.toggle('show');
navToggle.setAttribute('aria-expanded', show);
});
}
// 年份
const y = document.getElementById('year');
if (y) y.textContent = new Date().getFullYear();
// 统计数字滚动
function animateCount(el){
const target = +el.dataset.count || 0;
const duration = 1200;
const start = performance.now();
function tick(now){
const p = Math.min((now – start)/duration, 1);
el.textContent = Math.floor(target * (0.15 + 0.85 * (p<0.5? 2*p*p : 1 – Math.pow(–2*p+2,2)/2)));
if (p < 1) requestAnimationFrame(tick);
}
requestAnimationFrame(tick);
}
window.addEventListener('load', ()=>{
document.querySelectorAll('.num').forEach(animateCount);
});
// 赛博网格粒子背景
(function fx(){
const canvas = document.getElementById('fx');
if (!canvas) return;
const dpr = Math.min(window.devicePixelRatio || 1, 2);
const ctx = canvas.getContext('2d');
let W, H, t = 0;
function resize(){
W = canvas.clientWidth; H = Math.max(480, canvas.clientHeight);
canvas.width = W * dpr; canvas.height = H * dpr; ctx.setTransform(dpr,0,0,dpr,0,0);
}
window.addEventListener('resize', resize); resize();
const stars = Array.from({length: 140}, ()=>({
x: Math.random()*W, y: Math.random()*H, z: Math.random()*1+0.3, r: Math.random()*1.2+0.3
}));
function drawGrid(){
ctx.save();
ctx.clearRect(0,0,W,H);
// 渐变背景光
const g = ctx.createLinearGradient(0,0,W,H);
g.addColorStop(0,'rgba(0,245,255,0.05)');
g.addColorStop(1,'rgba(124,58,237,0.05)');
ctx.fillStyle = g; ctx.fillRect(0,0,W,H);
// 透视网格
const baseY = H*0.65;
const gridSize = 26;
ctx.strokeStyle = 'rgba(148,163,184,0.18)';
ctx.lineWidth = 1;
for(let i=–40;i<60;i++){
const off = (i*gridSize + (t*22)%gridSize);
// 横向线条向下流动
ctx.beginPath();
ctx.moveTo(0, baseY + off);
ctx.lineTo(W, baseY + off);
ctx.stroke();
}
// 纵向线条带透视
const cols = 24;
for(let i=0;i<=cols;i++){
const x = (i/cols)*W;
ctx.beginPath();
ctx.moveTo(x, baseY–140);
ctx.lineTo(x + (i – cols/2)*6, H);
ctx.stroke();
}
// 星点与流星
for(const s of stars){
ctx.fillStyle = `rgba(255,255,255,${0.4 + s.z*0.6})`;
const sx = (s.x + t*30*s.z) % (W+80) – 40;
const sy = (s.y + Math.sin((s.x+t*0.6)/80)*6);
ctx.beginPath(); ctx.arc(sx, sy, s.r, 0, Math.PI*2); ctx.fill();
// 拖尾
ctx.strokeStyle = `rgba(0,245,255,${0.15 + s.z*0.2})`;
ctx.beginPath(); ctx.moveTo(sx–6*s.z, sy); ctx.lineTo(sx, sy); ctx.stroke();
}
// 中心发光圈
const cx = W*0.18, cy = H*0.32, R = 86 + Math.sin(t)*6;
const grad = ctx.createRadialGradient(cx, cy, 10, cx, cy, R+60);
grad.addColorStop(0,'rgba(124,58,237,.35)');
grad.addColorStop(1,'rgba(124,58,237,0)');
ctx.fillStyle = grad; ctx.beginPath(); ctx.arc(cx, cy, R+60, 0, Math.PI*2); ctx.fill();
// 扫描线
ctx.fillStyle = 'rgba(0,245,255,0.045)';
const slY = (t*120)%H; ctx.fillRect(0, slY, W, 2);
ctx.restore();
}
function loop(){ t += 0.016; drawGrid(); requestAnimationFrame(loop); }
loop();
})();
styles.css
/* ———- 基础样式 ———- */
:root{
–bg:#0B1020;
–bg-soft:#0F1730;
–primary:#7C3AED; /* 紫色 */
–cyan:#00F5FF; /* 亮青 */
–text:#E5E7EB; /* 文本 */
–muted:#9CA3AF; /* 次级文本 */
–card:#0D1326;
–glass:rgba(255,255,255,0.06);
–border:rgba(255,255,255,0.12);
–shadow:0 10px 30px rgba(0,0,0,.4);
}
*{box-sizing:border-box}
html,body{height:100%}
body{
margin:0; font-family:Inter, system-ui, -apple-system, Segoe UI, Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
background:radial-gradient(1200px 600px at 10% -10%, rgba(124,58,237,.25), transparent 60%),
radial-gradient(800px 400px at 110% 10%, rgba(0,245,255,.18), transparent 60%),
var(–bg);
color:var(–text); line-height:1.6; overflow-x:hidden;
}
.container{width:min(1200px, 92%); margin:0 auto}
/* ———- Header ———- */
.site-header{position:sticky; top:0; z-index:50; backdrop-filter:blur(10px); background:linear-gradient(180deg, rgba(10,12,24,.75), rgba(10,12,24,.35), rgba(10,12,24,0)); border-bottom:1px solid var(–border)}
.header-inner{display:flex; align-items:center; justify-content:space-between; height:70px}
.logo{display:flex; align-items:center; gap:10px; color:var(–text); text-decoration:none}
.logo-text{font-family:Orbitron, Inter, sans-serif; letter-spacing:.5px; font-weight:700}
.logo-mark{filter:drop-shadow(0 0 10px rgba(0,245,255,.35))}
.nav{display:flex; align-items:center; gap:24px}
.nav a{color:var(–muted); text-decoration:none; font-weight:500}
.nav a:hover{color:var(–text)}
.btn{display:inline-flex; align-items:center; justify-content:center; padding:10px 16px; border-radius:10px; border:1px solid var(–border); color:var(–text); text-decoration:none; background:linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03)); box-shadow:var(–shadow); transition:transform .2s ease, box-shadow .2s ease}
.btn:hover{transform:translateY(-1px); box-shadow:0 10px 30px rgba(124,58,237,.25)}
.btn-primary{border-color:rgba(124,58,237,.5); background:linear-gradient(180deg, rgba(124,58,237,.45), rgba(124,58,237,.2)); color:white}
.btn-ghost{background:transparent}
.nav-toggle{display:none; flex-direction:column; gap:5px; background:none; border:0; padding:8px}
.nav-toggle span{width:22px; height:2px; background:#cbd5e1; display:block}
/* ———- Hero ———- */
.hero{position:relative; min-height:86vh; display:flex; align-items:center;}
.hero #fx{position:absolute; inset:0; width:100%; height:100%}
.hero::after{content:""; position:absolute; inset:0; pointer-events:none; background:
radial-gradient(600px 200px at 30% 60%, rgba(0,245,255,.15), transparent 60%),
radial-gradient(500px 250px at 70% 30%, rgba(124,58,237,.18), transparent 60%)}
.hero-inner{position:relative; z-index:2; padding:80px 0}
.neon-text{font-family:Orbitron, Inter, sans-serif; font-weight:800; letter-spacing:1px; font-size:clamp(34px, 6vw, 64px); line-height:1.1; margin:0 0 14px; background:linear-gradient(90deg, var(–cyan), #a78bfa, var(–text)); -webkit-background-clip:text; background-clip:text; color:transparent; filter:drop-shadow(0 8px 30px rgba(124,58,237,.35))}
.hero .sub{color:#c7d2fe; font-size:clamp(16px, 2.2vw, 20px); opacity:.95; margin:0 0 20px}
.cta{display:flex; gap:14px; margin-bottom:26px}
.stats{display:flex; gap:26px; list-style:none; padding:0; margin:20px 0 0}
.stats li{display:flex; flex-direction:column; align-items:flex-start; gap:6px; background:var(–glass); border:1px solid var(–border); padding:12px 16px; border-radius:12px; backdrop-filter:blur(8px)}
.stats .num{font:800 22px/1 Orbitron, Inter, sans-serif; color:white}
.stats .label{font-size:12px; color:var(–muted)}
/* ———- Sections ———- */
.section{padding:80px 0}
.section.alt{background:linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,0))}
.section-title{font:700 28px/1.2 Inter, sans-serif; margin:0 0 26px}
.grid{display:grid; gap:20px}
.cards{grid-template-columns:repeat(4, 1fr)}
.card{background:linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02)); border:1px solid var(–border); border-radius:14px; padding:20px; box-shadow:var(–shadow); transition:transform .25s ease, box-shadow .25s ease; position:relative; overflow:hidden}
.card:hover{transform:translateY(-3px); box-shadow:0 20px 50px rgba(124,58,237,.25)}
.card .icon{width:52px; height:52px; display:grid; place-items:center; border-radius:12px; background:radial-gradient(60% 60% at 30% 30%, rgba(0,245,255,.2), rgba(124,58,237,.2)); margin-bottom:10px}
.card h3{margin:6px 0 8px}
.card p{color:var(–muted); margin:0}
.solutions{grid-template-columns:repeat(3, 1fr)}
.solution{background:linear-gradient(180deg, rgba(124,58,237,.12), rgba(124,58,237,.04)); border:1px solid rgba(124,58,237,.35); border-radius:14px; padding:20px}
.solution h3{margin:8px 0 10px}
.solution ul{margin:0; padding:0 0 0 18px; color:#d1d5db}
/* ———- Partners ———- */
.marquee{overflow:hidden; border:1px solid var(–border); border-radius:14px; background:var(–glass)}
.track{display:flex; gap:20px; padding:16px; width:max-content; animation:scroll 40s linear infinite}
.brand{width:160px; height:40px; display:grid; place-items:center; opacity:.9}
@keyframes scroll{from{transform:translateX(0)} to{transform:translateX(-50%)} }
/* ———- Footer ———- */
.site-footer{border-top:1px solid var(–border); background:rgba(10,12,24,.6); backdrop-filter:blur(10px)}
.footer-inner{display:flex; justify-content:space-between; align-items:center; padding:24px 0}
.f-brand .logo{margin-bottom:6px}
.f-links{display:flex; gap:18px}
.f-links a{color:var(–muted); text-decoration:none}
.f-links a:hover{color:var(–text)}
/* ———- Reveal 动画 ———- */
.reveal{opacity:0; transform:translateY(18px); animation:reveal .8s ease forwards; animation-delay:var(–d, 0s)}
@keyframes reveal{to{opacity:1; transform:none}}
/* ———- 响应式 ———- */
@media (max-width: 1024px){
.cards{grid-template-columns:repeat(2, 1fr)}
.solutions{grid-template-columns:repeat(2, 1fr)}
}
@media (max-width: 640px){
.header-inner{height:64px}
.nav{position:fixed; inset:64px 0 auto 0; background:rgba(10,12,24,.95); backdrop-filter:blur(10px); padding:16px; border-bottom:1px solid var(–border); flex-direction:column; transform:translateY(-120%); transition:transform .25s ease}
.nav.show{transform:translateY(0)}
.nav-toggle{display:flex}
.cards{grid-template-columns:1fr}
.solutions{grid-template-columns:1fr}
.stats{gap:12px}
}
🎊 总结
-
这个科技风公司首页模板展示了如何用现代前端技术打造视觉震撼的Web体验。通过精心的设计系统、流畅的动画效果和完善的响应式适配,我们创造了一个既有科技感又具备实用性的企业门户。
-
无论你是前端开发者、设计师还是产品经理,希望这个项目能为你的工作带来启发。在追求视觉效果的同时,不要忘记用户体验和代码质量的重要性。
关键成功要素:
-
🎨 一致的视觉设计语言
-
⚡ 流畅的动画与交互
-
📱 完善的响应式适配
-
🔧 可维护的代码结构
-
🚀 优秀的页面性能
-
未来的Web开发将更加注重体验和性能的平衡,这个项目为我们提供了一个很好的实践参考。让我们继续探索前端技术的无限可能!
-
希望对初学者有帮助;致力于办公自动化的小小程序员一枚
-
希望能得到大家的【❤️一个免费关注❤️】感谢!
-
求个 🤞 关注 🤞 +❤️ 喜欢 ❤️ +👍 收藏 👍
-
此外还有办公自动化专栏,欢迎大家订阅:Python办公自动化专栏
-
此外还有爬虫专栏,欢迎大家订阅:Python爬虫基础专栏
-
此外还有Python基础专栏,欢迎大家订阅:Python基础学习专栏
评论前必须登录!
注册