用html和css做一个淘宝搜索页面
时间: 2024-05-18 11:18:35 浏览: 235
html+css的淘宝首页
5星 · 资源好评率100%
好的,以下是一个简单的淘宝搜索页面的HTML和CSS代码示例:
```HTML
<!DOCTYPE html>
<html>
<head>
<title>淘宝搜索</title>
<style type="text/css">
body {
background-color: #f5f5f5;
font-family: Arial, sans-serif;
}
.container {
margin: 0 auto;
width: 960px;
padding: 20px;
background-color: #fff;
box-shadow: 0 0 10px rgba(0,0,0,0.2);
}
.header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 20px;
}
.logo {
font-size: 32px;
font-weight: bold;
color: #ff4400;
}
.search-box {
display: flex;
align-items: center;
height: 40px;
border: 1px solid #ccc;
border-radius: 20px;
overflow: hidden;
}
.search-input {
flex: 1;
height: 100%;
padding: 0 20px;
border: none;
font-size: 18px;
}
.search-button {
height: 100%;
padding: 0 20px;
background-color: #ff4400;
border: none;
color: #fff;
font-size: 18px;
cursor: pointer;
}
.category-list {
display: flex;
align-items: center;
margin-bottom: 20px;
}
.category-item {
margin-right: 20px;
color: #666;
font-size: 16px;
cursor: pointer;
}
.category-item.active {
color: #ff4400;
font-weight: bold;
}
.product-list {
display: flex;
flex-wrap: wrap;
margin-bottom: 20px;
}
.product-item {
flex: 0 0 25%;
padding: 20px;
background-color: #fff;
box-shadow: 0 0 5px rgba(0,0,0,0.1);
margin-right: 20px;
margin-bottom: 20px;
}
.product-item:last-child {
margin-right: 0;
}
.product-item .image {
height: 200px;
background-color: #f5f5f5;
margin-bottom: 10px;
}
.product-item .title {
font-size: 16px;
color: #333;
margin-bottom: 10px;
}
.product-item .price {
font-size: 18px;
color: #ff4400;
font-weight: bold;
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<div class="logo">淘宝搜索</div>
<div class="search-box">
<input type="text" class="search-input" placeholder="请输入关键字">
<button class="search-button">搜索</button>
</div>
</div>
<div class="category-list">
<div class="category-item active">全部</div>
<div class="category-item">女装</div>
<div class="category-item">男装</div>
<div class="category-item">鞋包</div>
<div class="category-item">运动</div>
<div class="category-item">数码</div>
<div class="category-item">家电</div>
<div class="category-item">美妆</div>
<div class="category-item">母婴</div>
<div class="category-item">家居</div>
<div class="category-item">食品</div>
</div>
<div class="product-list">
<div class="product-item">
<div class="image"></div>
<div class="title">商品1</div>
<div class="price">¥100.00</div>
</div>
<div class="product-item">
<div class="image"></div>
<div class="title">商品2</div>
<div class="price">¥200.00</div>
</div>
<div class="product-item">
<div class="image"></div>
<div class="title">商品3</div>
<div class="price">¥300.00</div>
</div>
<div class="product-item">
<div class="image"></div>
<div class="title">商品4</div>
<div class="price">¥400.00</div>
</div>
<div class="product-item">
<div class="image"></div>
<div class="title">商品5</div>
<div class="price">¥500.00</div>
</div>
<div class="product-item">
<div class="image"></div>
<div class="title">商品6</div>
<div class="price">¥600.00</div>
</div>
<div class="product-item">
<div class="image"></div>
<div class="title">商品7</div>
<div class="price">¥700.00</div>
</div>
<div class="product-item">
<div class="image"></div>
<div class="title">商品8</div>
<div class="price">¥800.00</div>
</div>
</div>
</div>
</body>
</html>
```
以上代码实现了一个简单的淘宝搜索页面,包括搜索框、分类列表和商品列表等内容。你可以根据需要进行修改和扩展。
阅读全文