<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>示例网页</title>
<style>
/* 简单的样式 */
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
}
header {
background-color: #4CAF50;
color: white;
padding: 10px 0;
text-align: center;
}
nav {
display: flex;
justify-content: center;
background-color: #333;
}
nav a {
color: white;
padding: 14px 20px;
text-decoration: none;
text-align: center;
}
nav a:hover {
background-color: #ddd;
color: black;
}
section {
padding: 20px;
margin: 20px;
background-color: white;
}
footer {
background-color: #333;
color: white;
text-align: center;
padding: 10px 0;
position: fixed;
bottom: 0;
width: 100%;
}
</style>
</head>
<body>
<header>
<h1>欢迎来到我的网页</h1>
</header>
<nav>
<a href="#home">首页</a>
<a href="#about">关于我们</a>
<a href="#services">服务</a>
<a href="#contact">联系我们</a>
</nav>
<section>
<h2>关于我们的信息</h2>
<p>这是一个简单的HTML网页示例。你可以根据需要修改内容和样式。</p>
</section>
<footer>
<p>© 2023 示例网页. 保留所有权利。</p>
</footer>
</body>
</html>
<!DOCTYPE html>
声明文档类型为HTML5。<html>
标签是HTML文档的根元素,lang="zh-CN"
指定文档的语言为简体中文。<head>
包含了文档的元数据,如字符编码 (<meta charset="UTF-8">
)、视口设置 (<meta name="viewport" content="width=device-width, initial-scale=1.0">
) 和标题 (<title>
).<style>
标签内定义了页面的基本样式,包括字体、背景颜色、导航栏样式等。<body>
包含了网页的主要内容,分为头部 (<header>
)、导航栏 (<nav>
)、主体部分 (<section>
) 和页脚 (<footer>
).<a>
标签用于创建链接,点击后可以跳转到页面的不同部分或外部链接。这个示例代码展示了如何用HTML和CSS创建一个简单的静态网页。
上一篇:html 行间距
下一篇:html表格模板
Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3
Laravel 中文站