写一个美食网页htnl css js 网页
时间: 2023-10-07 22:11:04 浏览: 185
好的,以下是一个简单的美食网页的 HTML、CSS、JS 代码:
HTML 代码:
```
<!DOCTYPE html>
<html lang="en">
<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>
<h2>热门菜谱</h2>
<div class="recipes-container">
<div class="recipe">
<img src="https://picsum.photos/id/237/200/200" alt="">
<h3>麻辣香锅</h3>
<p>热度:★★★★★</p>
</div>
<div class="recipe">
<img src="https://picsum.photos/id/238/200/200" alt="">
<h3>红烧肉</h3>
<p>热度:★★★★☆</p>
</div>
<div class="recipe">
<img src="https://picsum.photos/id/239/200/200" alt="">
<h3>蒸鱼</h3>
<p>热度:★★★★</p>
</div>
</div>
</section>
<section>
<h2>最新食谱</h2>
<div class="recipes-container">
<div class="recipe">
<img src="https://picsum.photos/id/240/200/200" alt="">
<h3>麻婆豆腐</h3>
<p>发布日期:2021-06-01</p>
</div>
<div class="recipe">
<img src="https://picsum.photos/id/241/200/200" alt="">
<h3>水煮鱼</h3>
<p>发布日期:2021-06-01</p>
</div>
<div class="recipe">
<img src="https://picsum.photos/id/242/200/200" alt="">
<h3>口水鸡</h3>
<p>发布日期:2021-06-01</p>
</div>
</div>
</section>
</main>
<footer>
<p>©2021 美食网页</p>
</footer>
<script src="script.js"></script>
</body>
</html>
```
CSS 代码:
```
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: Arial, sans-serif;
font-size: 16px;
line-height: 1.5;
}
header {
background-color: #f2f2f2;
padding: 20px;
display: flex;
justify-content: space-between;
align-items: center;
box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.1);
}
nav ul {
list-style: none;
display: flex;
}
nav li {
margin-left: 20px;
}
nav a {
color: #333;
text-decoration: none;
}
nav a:hover {
color: #f00;
}
main {
padding: 20px;
}
section {
margin-bottom: 50px;
}
h2 {
font-size: 24px;
margin-bottom: 20px;
text-align: center;
}
.recipes-container {
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
}
.recipe {
margin: 20px;
text-align: center;
}
.recipe img {
width: 200px;
height: 200px;
border-radius: 50%;
margin-bottom: 10px;
}
.recipe h3 {
font-size: 20px;
margin-bottom: 10px;
}
.recipe p {
color: #f00;
}
```
JS 代码:
```
// 这里可以写一些交互效果的代码。
```
阅读全文
相关推荐
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241231044955.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)