html水果网页代码
时间: 2023-07-03 07:06:22 浏览: 110
以下是一个简单的 HTML 水果网页代码示例:
```html
<!DOCTYPE html>
<html>
<head>
<title>水果网页</title>
</head>
<body>
<h1>水果列表</h1>
<ul>
<li>苹果</li>
<li>香蕉</li>
<li>橙子</li>
<li>草莓</li>
</ul>
</body>
</html>
```
该代码包括了一个 HTML 文档的基本结构,其中包含一个标题、一个列表和四个列表项,每个列表项表示一个水果。
相关问题
html水果网页
好的,您想了解如何制作一个水果网页的HTML页面吗?以下是一个简单的HTML代码示例,可以帮助您入门:
```
<!DOCTYPE html>
<html>
<head>
<title>水果网页</title>
</head>
<body>
<h1>水果网页</h1>
<p>欢迎来到水果网页!这里有各种新鲜水果供您选择。</p>
<h2>水果列表</h2>
<ul>
<li>苹果</li>
<li>香蕉</li>
<li>橙子</li>
<li>葡萄</li>
</ul>
</body>
</html>
```
在这个示例中,您可以看到我们使用了HTML标记来创建网页的结构和内容。`<!DOCTYPE html>` 声明了文档类型,告诉浏览器我们使用的是HTML5标准。`<html>` 标记定义了整个文档的开始和结束。`<head>` 标记包含了文档的元数据,比如网页标题和样式表。`<body>` 标记包含了网页的主要内容。`<h1>` 和 `<h2>` 标记定义了标题,`<p>` 标记定义了段落,`<ul>` 和 `<li>` 标记定义了一个无序列表。
您可以根据自己的需要,修改和添加这些标记来创建您自己的水果网页。希望这个示例对您有所帮助!
帮我写完整的一个水果网页html和css代码要有
好的,以下是一个简单的水果网页的HTML和CSS代码:
HTML代码:
```html
<!DOCTYPE html>
<html>
<head>
<title>水果网站</title>
<link rel="stylesheet" type="text/css" 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 id="banner">
<h2>新鲜水果</h2>
<p>我们提供最新鲜的水果,从农场直接送到您的家门口。</p>
<button>立即购买</button>
</section>
<section id="products">
<h2>水果分类</h2>
<div class="product">
<img src="apple.jpg" alt="苹果">
<h3>苹果</h3>
<p>¥3.50/斤</p>
<button>加入购物车</button>
</div>
<div class="product">
<img src="banana.jpg" alt="香蕉">
<h3>香蕉</h3>
<p>¥2.50/斤</p>
<button>加入购物车</button>
</div>
<div class="product">
<img src="orange.jpg" alt="橙子">
<h3>橙子</h3>
<p>¥4.00/斤</p>
<button>加入购物车</button>
</div>
</section>
</main>
<footer>
<p>版权所有 © 2021 水果网站</p>
</footer>
</body>
</html>
```
CSS代码:
```css
body {
margin: 0;
font-family: Arial, sans-serif;
}
header {
background-color: #f7b733;
padding: 20px;
}
h1 {
color: #fff;
margin: 0;
}
nav {
float: right;
}
nav ul {
list-style: none;
margin: 0;
padding: 0;
}
nav li {
display: inline-block;
margin-left: 20px;
}
nav a {
color: #fff;
text-decoration: none;
}
main {
max-width: 1200px;
margin: 20px auto;
padding: 0 20px;
}
#banner {
background-image: url(banner.jpg);
background-size: cover;
background-position: center;
text-align: center;
color: #fff;
padding: 100px 0;
}
#banner h2 {
font-size: 48px;
margin: 0;
}
#banner p {
font-size: 24px;
margin: 20px 0;
}
button {
background-color: #f7b733;
color: #fff;
border: none;
padding: 10px 20px;
font-size: 16px;
cursor: pointer;
}
#products {
display: flex;
flex-wrap: wrap;
}
.product {
flex-basis: calc(33.33% - 20px);
margin: 20px;
text-align: center;
}
.product img {
width: 100%;
}
.product h3 {
margin: 10px 0;
}
.product p {
color: #f7b733;
margin: 10px 0;
}
footer {
background-color: #333;
color: #fff;
text-align: center;
padding: 20px;
}
```
注意:这只是一个简单的示例,实际上,一个真正的网站需要更多的HTML和CSS代码来实现。