教程 html tutorial

简易博客结构

下面是一个简易博客的基本结构示例,包含头部、导航栏、文章列表和页脚。结构清晰,适合初学者参考。

HTML 代码示例

html
<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>简易博客</title>
    <style>
      body {
        font-family: "Microsoft YaHei", sans-serif;
        max-width: 800px;
        margin: 40px auto;
        padding: 0 20px;
        line-height: 1.6;
        background: #fff;
        color: #333;
      }
      header,
      footer {
        text-align: center;
        padding: 10px 0;
        border-bottom: 1px solid #ddd;
      }
      footer {
        border-top: 1px solid #ddd;
        border-bottom: none;
        font-size: 0.9em;
        color: #888;
      }
      nav {
        margin: 20px 0;
        text-align: center;
      }
      nav a {
        margin: 0 15px;
        text-decoration: none;
        color: #3498db;
      }
      article {
        margin-bottom: 30px;
        border-bottom: 1px solid #eee;
        padding-bottom: 20px;
      }
      article h2 {
        margin-bottom: 10px;
        color: #2c3e50;
      }
      article p {
        color: #666;
      }
    </style>
  </head>
  <body>
    <header>
      <h1>我的简易博客</h1>
    </header>

    <nav>
      <a href="#">首页</a>
      <a href="#">关于</a>
      <a href="#">联系</a>
    </nav>

    <main>
      <article>
        <h2>第一篇文章标题</h2>
        <p>这是文章摘要内容,简单介绍文章的主要内容和亮点。</p>
      </article>

      <article>
        <h2>第二篇文章标题</h2>
        <p>这里是另一篇文章的摘要,帮助读者快速了解文章信息。</p>
      </article>
    </main>

    <footer>&copy; 2025 简易博客 版权所有</footer>
  </body>
</html>