用css5+html5做一个有珠宝系列的网页,要框架清晰且精美的网页,要用外部样式
时间: 2024-03-22 21:40:28 浏览: 12
好的,我可以为您提供一个有珠宝系列的网页的代码示例,使用 HTML5 和 CSS3 来实现清晰且精美的网页,并且使用外部样式表进行样式定义。
HTML5 代码:
```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>
</ul>
</nav>
</header>
<main>
<section class="product-group">
<h2>戒指系列</h2>
<div class="product">
<img src="ring1.jpg" alt="戒指1">
<h3>戒指1</h3>
<p>描述信息</p>
</div>
<div class="product">
<img src="ring2.jpg" alt="戒指2">
<h3>戒指2</h3>
<p>描述信息</p>
</div>
<div class="product">
<img src="ring3.jpg" alt="戒指3">
<h3>戒指3</h3>
<p>描述信息</p>
</div>
</section>
<section class="product-group">
<h2>项链系列</h2>
<div class="product">
<img src="necklace1.jpg" alt="项链1">
<h3>项链1</h3>
<p>描述信息</p>
</div>
<div class="product">
<img src="necklace2.jpg" alt="项链2">
<h3>项链2</h3>
<p>描述信息</p>
</div>
<div class="product">
<img src="necklace3.jpg" alt="项链3">
<h3>项链3</h3>
<p>描述信息</p>
</div>
</section>
<section class="product-group">
<h2>手链系列</h2>
<div class="product">
<img src="bracelet1.jpg" alt="手链1">
<h3>手链1</h3>
<p>描述信息</p>
</div>
<div class="product">
<img src="bracelet2.jpg" alt="手链2">
<h3>手链2</h3>
<p>描述信息</p>
</div>
<div class="product">
<img src="bracelet3.jpg" alt="手链3">
<h3>手链3</h3>
<p>描述信息</p>
</div>
</section>
</main>
<footer>
<p>版权所有 © 2021 珠宝系列</p>
</footer>
</body>
</html>
```
CSS3 代码:
```css
/* 通用样式 */
body {
margin: 0;
padding: 0;
font-family: Arial, sans-serif;
}
h1, h2, h3 {
margin: 0;
}
ul {
margin: 0;
padding: 0;
list-style: none;
}
a {
text-decoration: none;
color: #000;
}
/* 头部样式 */
header {
background-color: #f8f8f8;
padding: 20px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
header h1 {
font-size: 36px;
margin-bottom: 10px;
}
nav ul {
display: flex;
justify-content: flex-end;
align-items: center;
}
nav li {
margin-left: 20px;
}
/* 产品展示样式 */
main {
padding: 40px;
}
.product-group {
margin-bottom: 60px;
}
.product-group h2 {
font-size: 24px;
margin-bottom: 20px;
}
.product {
background-color: #f8f8f8;
padding: 20px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
text-align: center;
}
.product img {
max-width: 100%;
margin-bottom: 10px;
}
.product h3 {
font-size: 20px;
margin-bottom: 10px;
}
.product p {
font-size: 16px;
color: #666;
}
/* 底部样式 */
footer {
background-color: #333;
color: #fff;
padding: 20px;
text-align: center;
}
```
使用上述代码,您可以创建一个清晰且精美的珠宝系列网页,其中包括顶部导航栏、产品展示和底部版权信息。使用外部样式表可以使代码更加整洁,方便维护和修改。