Skip to content

Personal Profile Page

入门 约 15 分钟

你将构建什么

standalone .HTML file 那个 displays 你的 name, placeholder photo, 短 bio paragraph, and bulleted 列表的 three skills 你想要到 学习.

学习目标

  • 编写有效 HTML5 document 从 scratch 使用 doctype, head, and 请求体
  • Use 语义 headings (h1, h2) 到结构内容
  • 添加镜像使用 img 元素 and alt 文本 for accessibility
  • 创建 bulleted 列表使用 ul and li 元素

前置要求

  • 基础理解的 什么 HTML 是 and 什么标签做
  • 文本 editor or CoderNewbie playground

步骤

  1. 1

    设置 document skeleton

    创建 file profile.HTML 使用 HTML5 doctype, HTML 元素, head 包含 title and charset, and 空请求体. 这个 skeleton 是必需 shell 的每个 HTML page.

    代码
    <!DOCTYPE html>
    <html lang="en">
      <head>
        <meta charset="UTF-8">
        <title>My Profile</title>
      </head>
      <body>
      </body>
    </html>

    预期结果

    打开 file in 浏览器 shows 空白 page 使用 tab title "My Profile".

  2. 2

    添加你的 name and photo

    内部请求体, 添加 h1 使用你的 name and img 标签 pointing 到 placeholder 镜像. 总是包含 alt attribute 所以 screen readers and broken-镜像状态有 fallback.

    代码
    <h1>Alex Lee</h1>
    <img src="https://placehold.co/200x200" alt="Photo of Alex Lee">

    预期结果

    page 现在 shows 你的 name as 大 heading and 200×200 placeholder 镜像.

  3. 3

    编写短 bio

    Below photo, 添加 h2 heading "About me" followed 通过 p paragraph 使用 two or three sentences 描述谁 你是 and 什么你 想要到 学习.

    代码
    <h2>About me</h2>
    <p>I am a new developer learning web basics. I enjoy solving small puzzles and want to build my first real website this month.</p>

    预期结果

    sub-heading and paragraph 的 bio 文本 appear under photo.

  4. 4

    列表你的 skills

    添加 h2 "Skills I am learning" and ul 使用 three li 项. 列表是 正确元素 for 任何集合的 parallel 项.

    代码
    <h2>Skills I am learning</h2>
    <ul>
      <li>HTML structure</li>
      <li>CSS colors and spacing</li>
      <li>JavaScript basics</li>
    </ul>

    预期结果

    bulleted 列表的 three skills 渲染 at 底部的 page.

  5. 5

    添加响应式样式

    使用媒体查询为移动端调整布局:在小屏幕上将多列改为单列、缩小字号、调整间距。移动优先意味着小屏幕体验同样重要。

    代码
    @media (max-width: 640px) {
      .container {
        flex-direction: column;
        padding: 1rem;
      }
      h1 { font-size: 1.5rem; }
      .card { width: 100%; margin-bottom: 1rem; }
    }

    预期结果

    在 640px 以下视口,布局变为单列,字号和间距缩小,内容不溢出。

自己动手试试

你学到了什么

你 wrote 完整, 有效 HTML5 document 从 scratch using 语义元素 (h1, h2, p, ul, li, img) — 相同结构每个 web page 开始从.

相关资源

相关课程

  • HTML

    doctype, head, 请求体 skeleton used 在本项目中.

  • HTML

    Headings, paragraphs, 列表, and 镜像 covered 这里.

相关练习

相关工具

相关速查表

相关参考文档

相关错误

相关术语

相关术语

新手友好的术语表用大白话解释编程术语——变量、函数、DOM、Promise 等等。

相关错误

用大白话解释常见错误——什么意思、为什么发生、如何修复。

← 返回主题