用html css js 写一个书城页面
时间: 2023-11-21 22:06:00 浏览: 229
好的,我可以为您提供一个简单的书城页面示例,代码如下:
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>书城</title>
<style type="text/css">
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f2f2f2;
}
.container {
max-width: 960px;
margin: 0 auto;
padding: 20px;
background-color: #fff;
}
h1 {
font-size: 36px;
font-weight: bold;
color: #333;
margin: 0 0 20px;
}
.book-list {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.book-item {
width: 30%;
margin-bottom: 30px;
background-color: #fff;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
transition: box-shadow 0.3s ease-in-out;
}
.book-item:hover {
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
.book-item img {
width: 100%;
height: 200px;
object-fit: cover;
}
.book-item h2 {
font-size: 24px;
font-weight: bold;
color: #333;
margin: 10px 0;
}
.book-item p {
font-size: 16px;
color: #666;
margin: 10px 0;
}
.book-item button {
padding: 10px 20px;
background-color: #333;
color: #fff;
border: none;
border-radius: 5px;
font-size: 16px;
cursor: pointer;
transition: background-color 0.3s ease-in-out;
}
.book-item button:hover {
background-color: #555;
}
</style>
</head>
<body>
<div class="container">
<h1>书城</h1>
<div class="book-list">
<div class="book-item">
<img src="https://via.placeholder.com/300x200" alt="Book Cover">
<h2>Book Title</h2>
<p>Book Author</p>
<button>Add to Cart</button>
</div>
<div class="book-item">
<img src="https://via.placeholder.com/300x200" alt="Book Cover">
<h2>Book Title</h2>
<p>Book Author</p>
<button>Add to Cart</button>
</div>
<div class="book-item">
<img src="https://via.placeholder.com/300x200" alt="Book Cover">
<h2>Book Title</h2>
<p>Book Author</p>
<button>Add to Cart</button>
</div>
<div class="book-item">
<img src="https://via.placeholder.com/300x200" alt="Book Cover">
<h2>Book Title</h2>
<p>Book Author</p>
<button>Add to Cart</button>
</div>
<div class="book-item">
<img src="https://via.placeholder.com/300x200" alt="Book Cover">
<h2>Book Title</h2>
<p>Book Author</p>
<button>Add to Cart</button>
</div>
<div class="book-item">
<img src="https://via.placeholder.com/300x200" alt="Book Cover">
<h2>Book Title</h2>
<p>Book Author</p>
<button>Add to Cart</button>
</div>
</div>
</div>
</body>
</html>
```
这个页面包括一个书城标题和一个书籍列表,每个书籍都有一个封面、标题、作者和添加到购物车的按钮。页面使用 HTML、CSS 和 JavaScript(没有实际使用)编写。您可以将其保存为 HTML 文件并在浏览器中打开以查看效果。
阅读全文