写一个小米商城网页,要有HTML css Javascript
时间: 2023-03-21 10:02:41 浏览: 141
好的,我会回答您的问题。以下是一个简单的小米商城网页的HTML、CSS和JavaScript代码:
HTML代码:
```
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>小米商城</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<h1>小米商城</h1>
<nav>
<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>
</nav>
</header>
<main>
<section class="banner">
<img src="banner.jpg" alt="小米商城">
</section>
<section class="products">
<h2>热门产品</h2>
<ul>
<li>
<img src="product1.jpg" alt="小米10">
<h3>小米10</h3>
<p>价格:3999元</p>
</li>
<li>
<img src="product2.jpg" alt="小米电视">
<h3>小米电视</h3>
<p>价格:2999元</p>
</li>
<li>
<img src="product3.jpg" alt="小米笔记本">
<h3>小米笔记本</h3>
<p>价格:5999元</p>
</li>
<li>
<img src="product4.jpg" alt="米家扫地机器人">
<h3>米家扫地机器人</h3>
<p>价格:1999元</p>
</li>
</ul>
</section>
</main>
<footer>
<p>© 2023 小米公司 版权所有</p>
</footer>
<script src="script.js"></script>
</body>
</html>
```
CSS代码:
```
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}
header {
background-color: #333;
color: #fff;
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px 20px;
}
nav ul {
display: flex;
list-style: none;
margin: 0;
padding: 0;
}
nav li {
margin-left: 20px;
}
nav a {
color: #fff;
text-decoration: none;
}
nav a:hover {
text-decoration: underline;
}
.banner img {
width: 100%;
}
.products {
margin: 20px;
}
.products h2 {
font-size: 24px;
}
.products ul {
display: flex;
list-style: none;
margin: 0;
padding: 0;
}
.products li {
border: 1px solid #ccc;
margin-right: 20px;
padding: 10px;
width: 200px;
text-align: center;
}
.products li:last-child {
margin-right: 0;
}
.products img {
width:
阅读全文