示例工程 01-what-is-html

01-what-is-html/demo-01-tags/index.html

html · 1.0 KB

运行:标签与文本

点击「运行示例」后,左侧显示源码、右侧显示运行结果;console 输出会实时回传。

<!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 { margin: 0; padding: 32px; background: #f8fafc; color: #0f172a; font-family: system-ui, sans-serif; line-height: 1.7; }
      .box { margin-top: 14px; padding: 14px; border: 1px solid #e2e8f0; border-radius: 10px; background: #fff; }
      code { background: #f1f5f9; padding: 1px 5px; border-radius: 4px; font-family: ui-monospace, Menlo, monospace; }
    </style>
  </head>
  <body>
    <h1>标签与文本</h1>
    <div class="box">
      <p>源码里的 <code>&lt;h2&gt;我是标题&lt;/h2&gt;</code> 会显示成文本。</p>
      <p>真正的标签会渲染成标题:</p>
      <h2>我是标题</h2>
    </div>
    <div class="box">
      <p>浏览器不会把 <code>&lt;strong&gt;</code> 当成普通文字,它会让内容更强调。</p>
      <p><strong>这段是强调文本。</strong></p>
    </div>
  </body>
</html>