1.写一个html页面
代码:
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>东京</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f5f5f5;
}
header {
background-color: #e81c4f;
color: white;
padding: 10px 0;
text-align: center;
}
.navbar {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px 20px;
}
.logo {
font-size: 24px;
font-weight: bold;
}
.search-bar {
display: flex;
flex-grow: 1;
margin: 0 20px;
}
.search-bar input {
flex-grow: 1;
padding: 10px;
border: none;
border-radius: 5px;
}
.search-bar button {
padding: 10px;
background-color: #ff6700;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}
.product-list {
display: flex;
flex-wrap: wrap;
justify-content: center;
padding: 20px;
}
.product {
background-color: white;
border: 1px solid #ddd;
border-radius: 5px;
margin: 10px;
padding: 10px;
width: 200px;
text-align: center;
}
.product img {
width: 100%;
height: auto;
border-radius: 5px;
}
.footer {
background-color: #e1e1e1;
text-align: center;
padding: 10px 0;
position: relative;
bottom: 0;
width: 100%;
}
</style>
</head>
<body>
<header>
<div class="navbar">
<div class="logo">东京</div>
<div class="search-bar">
<input type="text" placeholder="搜索商品">
<button type="button">搜索</button>
</div>
</div>
</header>
<main>
<h2 style="text-align: center;">热销商品</h2>
<div class="product-list">
<div class="product">
<img src="https://via.placeholder.com/150" alt="商品1">
<h3>商品名称1</h3>
<p>价格: ¥199.00</p>
</div>
<div class="product">
<img src="https://via.placeholder.com/150" alt="商品2">
<h3>商品名称2</h3>
<p>价格: ¥299.00</p>
</div>
<div class="product">
<img src="https://via.placeholder.com/150" alt="商品3">
<h3>商品名称3</h3>
<p>价格: ¥399.00</p>
</div>
<div class="product">
<img src="https://via.placeholder.com/150" alt="商品4">
<h3>商品名称4</h3>
<p>价格: ¥499.00</p>
</div>
</div>
</main>
<footer class="footer">
<p>© 2024 版权所有</p>
</footer>
</body>
</html>
运行结果:
2.思维导图