我来为你创建一个京东风格的网页,包含主要的页面元素和交互功能。

(图片来源网络,侵删)
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">京东 - 正品低价、品质保障、配送及时、轻松购物!</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: "Microsoft YaHei", Arial, sans-serif;
background-color: #f4f4f4;
}
/* 顶部导航栏 */
.top-bar {
background-color: #e3e4e5;
height: 30px;
line-height: 30px;
font-size: 12px;
color: #999;
}
.container {
width: 1190px;
margin: 0 auto;
}
.top-bar .left span, .top-bar .left a {
margin-right: 10px;
color: #999;
text-decoration: none;
}
.top-bar .left a:hover {
color: #e1251b;
}
.top-bar .right span, .top-bar .right a {
margin-left: 10px;
color: #999;
text-decoration: none;
}
.top-bar .right a:hover {
color: #e1251b;
}
/* 主导航栏 */
.header {
background-color: #fff;
height: 140px;
position: relative;
}
.logo {
float: left;
width: 190px;
height: 120px;
margin-top: 10px;
background-color: #e1251b;
color: white;
text-align: center;
line-height: 120px;
font-size: 36px;
font-weight: bold;
cursor: pointer;
}
.search-box {
float: left;
margin-top: 25px;
margin-left: 40px;
}
.search-box input {
width: 495px;
height: 32px;
border: 2px solid #e1251b;
padding: 0 10px;
font-size: 14px;
outline: none;
}
.search-box button {
width: 52px;
height: 36px;
background-color: #e1251b;
border: none;
color: white;
cursor: pointer;
font-size: 16px;
}
.cart {
float: right;
width: 190px;
height: 32px;
margin-top: 25px;
border: 2px solid #e1251b;
text-align: center;
line-height: 32px;
color: #e1251b;
cursor: pointer;
}
.nav-menu {
background-color: #e3e4e5;
height: 35px;
border-bottom: 2px solid #e1251b;
}
.nav-menu ul {
list-style: none;
display: flex;
height: 100%;
}
.nav-menu li {
padding: 0 25px;
line-height: 35px;
cursor: pointer;
transition: background-color 0.3s;
}
.nav-menu li:hover {
background-color: #fff;
}
/* 轮播图 */
.banner {
width: 1190px;
height: 400px;
margin: 20px auto;
position: relative;
overflow: hidden;
}
.banner-images {
display: flex;
width: 500%;
height: 100%;
transition: transform 0.5s;
}
.banner-images img {
width: 1190px;
height: 400px;
object-fit: cover;
}
.banner-dots {
position: absolute;
bottom: 20px;
left: 50%;
transform: translateX(-50%);
display: flex;
gap: 10px;
}
.dot {
width: 10px;
height: 10px;
border-radius: 50%;
background-color: rgba(255, 255, 255, 0.5);
cursor: pointer;
transition: background-color 0.3s;
}
.dot.active {
background-color: #fff;
}
/* 商品分类 */
.category-section {
background-color: #fff;
margin: 20px 0;
padding: 20px;
}
.category-title {
font-size: 24px;
color: #333;
margin-bottom: 20px;
border-left: 4px solid #e1251b;
padding-left: 10px;
}
.products-grid {
display: grid;
grid-template-columns: repeat(5, 1fr);
gap: 20px;
}
.product-card {
background-color: #fff;
border: 1px solid #eee;
padding: 15px;
text-align: center;
transition: all 0.3s;
cursor: pointer;
}
.product-card:hover {
transform: translateY(-5px);
box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}
.product-image {
width: 160px;
height: 160px;
background-color: #f4f4f4;
margin: 0 auto 10px;
display: flex;
align-items: center;
justify-content: center;
font-size: 60px;
color: #999;
}
.product-name {
font-size: 14px;
color: #333;
margin-bottom: 10px;
height: 40px;
overflow: hidden;
}
.product-price {
color: #e1251b;
font-size: 20px;
font-weight: bold;
}
.product-price::before {
content: "¥";
}
/* 服务保障 */
.service-section {
background-color: #fff;
margin: 20px 0;
padding: 30px;
text-align: center;
}
.service-items {
display: flex;
justify-content: space-around;
margin-top: 20px;
}
.service-item {
text-align: center;
}
.service-icon {
font-size: 40px;
color: #e1251b;
margin-bottom: 10px;
}
.service-text {
font-size: 14px;
color: #666;
}
/* 页脚 */
.footer {
background-color: #eaeaea;
padding: 40px 0;
margin-top: 50px;
}
.footer-content {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 30px;
margin-bottom: 30px;
}
.footer-column h4 {
color: #333;
margin-bottom: 15px;
font-size: 16px;
}
.footer-column ul {
list-style: none;
}
.footer-column li {
margin-bottom: 10px;
}
.footer-column a {
color: #666;
text-decoration: none;
font-size: 14px;
}
.footer-column a:hover {
color: #e1251b;
}
.footer-bottom {
text-align: center;
padding-top: 20px;
border-top: 1px solid #ddd;
color: #999;
font-size: 12px;
}
/* 响应式设计 */
@media (max-width: 1200px) {
.container {
width: 95%;
}
.products-grid {
grid-template-columns: repeat(3, 1fr);
}
}
@media (max-width: 768px) {
.search-box input {
width: 300px;
}
.banner {
height: 250px;
}
.banner-images img {
height: 250px;
}
.products-grid {
grid-template-columns: repeat(2, 1fr);
}
}
</style>
</head>
<body>
<!-- 顶部导航栏 -->
<div class="top-bar">
<div class="container">
<div class="left">
<span>送至:北京</span>
<a href="#">登录</a>
<a href="#">注册</a>
<a href="#">我的订单</a>
<a href="#">我的京东</a>
<a href="#">京东会员</a>
</div>
<div class="right">
<a href="#">企业采购</a>
<a href="#">客户服务</a>
<a href="#">网站导航</a>
<a href="#">手机京东</a>
</div>
</div>
</div>
<!-- 主导航栏 -->
<header class="header">
<div class="container">
<div class="logo">京东</div>
<div class="search-box">
<input type="text" placeholder="搜索商品">
<button>搜索</button>
</div>
<div class="cart">
我的购物车
</div>
</div>
</header>
<!-- 菜单导航 -->
<nav class="nav-menu">
<div class="container">
<ul>
<li>全部商品分类</li>
<li>京东超市</li>
<li>秒杀</li>
<li>优惠券</li>
<li>PLUS会员</li>
<li>品牌闪购</li>
<li>拍卖</li>
<li>京东金融</li>
</ul>
</div>
</nav>
<!-- 轮播图 -->
<div class="banner">
<div class="banner-images" id="bannerImages">
<img src="https://via.placeholder.com/1190x400/e1251b/ffffff?text=京东轮播图1" alt="Banner 1">
<img src="https://via.placeholder.com/1190x400/ff6b6b/ffffff?text=京东轮播图2" alt="Banner 2">
<img src="https://via.placeholder.com/1190x400/4ecdc4/ffffff?text=京东轮播图3" alt="Banner 3">
<img src="https://via.placeholder.com/1190x400/45b7d1/ffffff?text=京东轮播图4" alt="Banner 4">
<img src="https://via.placeholder.com/1190x400/f9ca24/ffffff?text=京东轮播图5" alt="Banner 5">
</div>
<div class="banner-dots">
<span class="dot active" onclick="changeSlide(0)"></span>
<span class="dot" onclick="changeSlide(1)"></span>
<span class="dot" onclick="changeSlide(2)"></span>
<span class="dot" onclick="changeSlide(3)"></span>
<span class="dot" onclick="changeSlide(4)"></span>
</div>
</div>
<!-- 商品分类 -->
<section class="category-section">
<div class="container">
<h2 class="category-title">热门商品</h2>
<div class="products-grid">
<div class="product-card">
<div class="product-image">📱</div>
<div class="product-name">iPhone 15 Pro Max 256GB 钛金属</div>
<div class="product-price">9999</div>
</div>
<div class="product-card">
<div class="product-image">💻</div>
<div class="product-name">MacBook Pro 14英寸 M3芯片</div>
<div class="product-price">14999</div>
</div>
<div class="product-card">
<div class="product-image">🎧</div>
<div class="product-name">AirPods Pro 2代 主动降噪</div>
<div class="product-price">1899</div>
</div>
<div class="product-card">
<div class="product-image">⌚</div>
<div class="product-name">Apple Watch Series 9 GPS</div>
<div class="product-price">2999</div>
</div>
<div class="product-card">
<div class="product-image">📷</div>
<div class="product-name">索尼 A7M5 全画幅微单相机</div>
<div class="product-price">24999</div>
</div>
<div class="product-card">
<div class="product-image">🎮</div>
<div class="product-name">PlayStation 5 游戏主机</div>
<div class="product-price">3899</div>
</div>
<div class="product-card">
<div class="product-image">⌨️</div>
<div class="product-name">罗技 MX Master 3S 无线鼠标</div>
<div class="product-price">699</div>
</div>
<div class="product-card">
<div class="product-image">🖥️</div>
<div class="product-name">戴尔 UltraSharp U2723QE 4K显示器</div>
<div class="product-price">3299</div>
</div>
<div class="product-card">
<div class="product-image">🔊</div>
<div class="product-name">Bose QuietComfort 45 无线耳机</div>
<div class="product-price">2299</div>
</div>
<div class="product-card">
<div class="product-image">⌨️</div>
<div class="product-name">Keychron K2 机械键盘</div>
<div class="product-price">599</div>
</div>
</div>
</div>
</section>
<!-- 服务保障 -->
<section class="service-section">
<div class="container">
<h2 class="category-title">服务保障</h2>
<div class="service-items">
<div class="service-item">
<div class="service-icon">🚚</div>
<div class="service-text">全场包邮</div>
</div>
<div class="service-item">
<div class="service-icon">💯</div>
<div class="service-text">正品保证</div>
</div>
<div class="service-item">
<div class="service-icon">🔄</div>
<div class="service-text">7天无理由退换</div>
</div>
<div class="service-item">
<div class="service-icon">🛡️</div>
<div class="service-text">售后无忧</div>
</div>
</div>
</div>
</section>
<!-- 页脚 -->
<footer class="footer">
<div class="container">
<div class="footer-content">
<div class="footer-column">
<h4>购物指南</h4>
<ul>
<li><a href="#">购物流程</a></li>
<li><a href="#">会员介绍</a></li>
<li><a href="#">生活旅行</a></li>
<li><a href="#">常见问题</a></li>
<li><a href="#">大家电</a></li>
<li><a href="#">联系客服</a></li>
</ul>
</div>
<div class="footer-column">
<h4>配送方式</h4>
<ul>
<li><a href="#">上门自提</a></li>
<li><a href="#">211限时达</a></li>
<li><a href="#">配送服务查询</a></li>
<li><a href="#">配送费收取标准</a></li>
<li><a href="#">海外配送</a></li>
</ul>
</div>
<div class="footer-column">
<h4>支付方式</h4>
<ul>
<li><a href="#">货到付款</a></li>
<li><a href="#">在线支付</a></li>
<li><a href="#">分期付款</a></li>
<li><a href="#">公司转账</a></li>
<li><a href="#">邮局汇款</a></li>
</ul>
</div>
<div class="footer-column">
<h4>售后服务</h4>
<ul>
<li><a href="#">售后政策</a></li>
<li><a href="#">价格保护</a></li>
<li><a href="#">退款说明</a></li>
<li><a href="#">返修/退换货</a></li>
<li><a href="#">取消订单</a></li>
</ul>
</div>
</div>
<div class="footer-bottom">
<p>© 2025 京东 版权所有 | 京ICP证070359号 | 京公网安备11000002000088号</p>
</div>
</div>
</footer>
<script>
// 轮播图功能
let currentSlide = 0;
const bannerImages = document.getElementById('bannerImages');
const dots = document.querySelectorAll('.dot');
function changeSlide(index) {
currentSlide = index;
bannerImages.style.transform = `translateX(-${index * 100}%)`;
dots.forEach((dot, i) => {
dot.classList.toggle('active', i === index);
});
}
// 自动轮播
setInterval(() => {
currentSlide = (currentSlide + 1) % 5;
changeSlide(currentSlide);
}, 3000);
// 商品卡片点击效果
const productCards = document.querySelectorAll('.product-card');
productCards.forEach(card => {
card.addEventListener('click', function() {
const productName = this.querySelector('.product-name').textContent;
const productPrice = this.querySelector('.product-price').textContent;
// 创建提示信息
const toast = document.createElement('div');
toast.style.cssText = `
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: rgba(0, 0, 0, 0.8);
color: white;
padding: 20px 40px;
border-radius: 10px;
z-index: 1000;
animation: fadeIn 0.3s ease;
`;
toast.innerHTML = `
<h3>商品信息</h3>
<p>商品名称:${productName}</p>
<p>商品价格:¥${productPrice}</p>
<p style="margin-top: 10px; font-size: 14px;">点击确定查看详情</p>
`;
document.body.appendChild(toast);
// 添加淡入动画
const style = document.createElement('style');
style.textContent = `
@keyframes fadeIn {
from { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
`;
document.head.appendChild(style);
// 3秒后自动消失
setTimeout(() => {
toast.style.animation = 'fadeIn 0.3s ease reverse';
setTimeout(() => {
document.body.removeChild(toast);
}, 300);
}, 2000);
});
});
// 搜索功能
const searchInput = document.querySelector('.search-box input');
const searchButton = document.querySelector('.search-box button');
searchButton.addEventListener('click', function() {
const searchTerm = searchInput.value.trim();
if (searchTerm) {
// 创建搜索提示
const searchToast = document.createElement('div');
searchToast.style.cssText = `
position: fixed;
top: 100px;
right: 20px;
background-color: #e1251b;
color: white;
padding: 15px 25px;
border-radius: 5px;
z-index: 1000;
animation: slideIn 0.3s ease;
`;
searchToast.textContent = `正在搜索: ${searchTerm}`;
document.body.appendChild(searchToast);
// 添加滑入动画
const style = document.createElement('style');
style.textContent = `
@keyframes slideIn {
from { transform: translateX(100%); opacity: 0; }
to { transform: translateX(0); opacity: 1; }
}
`;
document.head.appendChild(style);
// 3秒后消失
setTimeout(() => {
searchToast.style.animation = 'slideIn 0.3s ease reverse';
setTimeout(() => {
document.body.removeChild(searchToast);
}, 300);
}, 2000);
// 清空搜索框
searchInput.value = '';
}
});
// 回车搜索
searchInput.addEventListener('keypress', function(e) {
if (e.key === 'Enter') {
searchButton.click();
}
});
// 购物车点击效果
const cart = document.querySelector('.cart');
cart.addEventListener('click', function() {
const cartToast = document.createElement('div');
cartToast.style.cssText = `
position: fixed;
top: 100px;
right: 20px;
background-color: #333;
color: white;
padding: 15px 25px;
border-radius: 5px;
z-index: 1000;
animation: slideIn 0.3s ease;
`;
cartToast.textContent = '购物车功能开发中...';
document.body.appendChild(cartToast);
setTimeout(() => {
cartToast.style.animation = 'slideIn 0.3s ease reverse';
setTimeout(() => {
document.body.removeChild(cartToast);
}, 300);
}, 2000);
});
</script>
</body>
</html>
这个京东风格的网页包含了以下特点:
- 顶部导航栏 - 包含登录、注册、订单等常用链接
- 搜索功能 - 带有搜索框和搜索按钮,支持回车搜索
- 商品分类菜单 - 模拟京东的分类导航
- 轮播图 - 自动播放,支持手动切换
- 商品展示 - 网格布局展示商品,带悬停效果
- 服务保障 - 展示京东的服务特色
- 页脚信息 - 包含购物指南、配送方式等信息
交互功能:
- 轮播图自动播放和手动切换
- 商品卡片点击显示详情
- 搜索功能带提示动画
- 购物车点击提示
- 响应式设计,适配不同屏幕尺寸
整个页面采用了京东的经典红色(#e1251b)作为主题色,布局清晰,交互友好。

(图片来源网络,侵删)
