生成亚马逊首页结构的html和css代码
时间: 2023-12-30 13:02:13 浏览: 35
由于亚马逊首页结构非常复杂,无法在这里一一列举所有的HTML和CSS代码。但是,我可以提供一个大致的结构和样式,供您参考。
HTML代码:
```html
<!DOCTYPE html>
<html>
<head>
<title>Amazon</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<header>
<div class="logo">
<a href="#"><img src="amazon-logo.png"></a>
</div>
<div class="search">
<input type="text" placeholder="Search">
<button>Go</button>
</div>
<div class="cart">
<a href="#"><img src="cart-icon.png"></a>
<span>0</span>
</div>
</header>
<nav>
<ul>
<li><a href="#">Today's Deals</a></li>
<li><a href="#">Customer Service</a></li>
<li><a href="#">Gift Cards</a></li>
<li><a href="#">Registry</a></li>
<li><a href="#">Sell</a></li>
</ul>
</nav>
<main>
<section class="promo">
<a href="#"><img src="promo-banner.png"></a>
</section>
<section class="categories">
<h2>Shop by category</h2>
<ul>
<li><a href="#">Electronics</a></li>
<li><a href="#">Clothing, Shoes & Jewelry</a></li>
<li><a href="#">Home, Garden & Tools</a></li>
<li><a href="#">Toys & Games</a></li>
<li><a href="#">Sports & Outdoors</a></li>
<li><a href="#">Automotive & Industrial</a></li>
</ul>
</section>
<section class="featured">
<h2>Featured products</h2>
<ul>
<li>
<a href="#"><img src="product1.jpg"></a>
<h3>Product 1</h3>
<p>$99.99</p>
</li>
<li>
<a href="#"><img src="product2.jpg"></a>
<h3>Product 2</h3>
<p>$149.99</p>
</li>
<li>
<a href="#"><img src="product3.jpg"></a>
<h3>Product 3</h3>
<p>$199.99</p>
</li>
<li>
<a href="#"><img src="product4.jpg"></a>
<h3>Product 4</h3>
<p>$249.99</p>
</li>
</ul>
</section>
</main>
<footer>
<p>© 2021 Amazon.com, Inc. or its affiliates</p>
</footer>
</body>
</html>
```
CSS代码:
```css
/* Reset CSS */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
/* Global styles */
body {
font-family: Arial, Helvetica, sans-serif;
}
a {
text-decoration: none;
color: #333;
}
ul {
list-style: none;
}
/* Header styles */
header {
background-color: #232f3e;
color: #fff;
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px 20px;
}
.logo img {
height: 40px;
}
.search {
display: flex;
}
.search input[type="text"] {
padding: 10px;
border: none;
border-radius: 3px 0 0 3px;
}
.search button {
background-color: #febd69;
color: #333;
padding: 10px 20px;
border: none;
border-radius: 0 3px 3px 0;
cursor: pointer;
}
.cart {
display: flex;
align-items: center;
}
.cart img {
height: 30px;
margin-right: 5px;
}
.cart span {
background-color: #febd69;
color: #333;
padding: 5px 10px;
border-radius: 50%;
margin-left: 5px;
font-size: 14px;
}
/* Navigation styles */
nav {
background-color: #333;
color: #fff;
padding: 10px 20px;
}
nav ul {
display: flex;
justify-content: space-between;
align-items: center;
}
nav li {
margin: 0 10px;
}
nav a {
color: #fff;
}
/* Main styles */
main {
padding: 20px;
}
.promo img {
width: 100%;
}
.categories {
margin-top: 20px;
}
.categories h2 {
margin-bottom: 10px;
}
.categories ul {
display: flex;
flex-wrap: wrap;
}
.categories li {
width: 33.33%;
padding: 10px;
box-sizing: border-box;
}
.categories a {
display: block;
background-color: #f3f3f3;
color: #333;
padding: 20px;
text-align: center;
border-radius: 3px;
box-shadow: 0 0 5px rgba(0,0,0,0.1);
}
.featured {
margin-top: 20px;
}
.featured h2 {
margin-bottom: 10px;
}
.featured ul {
display: flex;
flex-wrap: wrap;
}
.featured li {
width: 25%;
padding: 10px;
box-sizing: border-box;
}
.featured a {
display: block;
background-color: #f3f3f3;
color: #333;
padding: 20px;
text-align: center;
border-radius: 3px;
box-shadow: 0 0 5px rgba(0,0,0,0.1);
}
.featured img {
width: 100%;
margin-bottom: 10px;
}
.featured h3 {
margin-bottom: 5px;
}
.featured p {
font-weight: bold;
}
/* Footer styles */
footer {
background-color: #f3f3f3;
color: #333;
text-align: center;
padding: 20px;
}
```