Personal Profile Page
你将构建什么
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
设置 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
添加你的 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
编写短 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
列表你的 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.
提示
如果 bullets 做不 appear, 制作确定每个项 是 wrapped in <li> 内部 <ul>.
- 5
添加响应式样式
使用媒体查询为移动端调整布局:在小屏幕上将多列改为单列、缩小字号、调整间距。移动优先意味着小屏幕体验同样重要。
代码@media (max-width: 640px) { .container { flex-direction: column; padding: 1rem; } h1 { font-size: 1.5rem; } .card { width: 100%; margin-bottom: 1rem; } }预期结果
在 640px 以下视口,布局变为单列,字号和间距缩小,内容不溢出。
自己动手试试
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>My Profile</title>
</head>
<body>
<!-- TODO: add h1 name, img, h2 + p bio, h2 + ul skills -->
</body>
</html><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>My Profile</title>
</head>
<body>
<h1>Alex Lee</h1>
<img src="https://placehold.co/200x200" alt="Photo of Alex Lee">
<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>
<h2>Skills I am learning</h2>
<ul>
<li>HTML structure</li>
<li>CSS colors and spacing</li>
<li>JavaScript basics</li>
</ul>
</body>
</html>你学到了什么
你 wrote 完整, 有效 HTML5 document 从 scratch using 语义元素 (h1, h2, p, ul, li, img) — 相同结构每个 web page 开始从.
相关资源
相关练习
- HTML 标签 MCQ
测验 on 哪个标签到 use for 哪个内容.
- HTML 结构查找
Spot 结构 mistakes in sample HTML file.
相关工具
- HTML/CSS/JS Minifier
Pretty-print 你的 HTML 到验证结构是 clean.
相关速查表
- HTML Cheatsheet
快速引用 for 每个标签 used 在本项目中.
相关参考文档
- HTML 元素引用
完整引用 for h1, h2, p, ul, li, and img 标签.
相关术语
新手友好的术语表用大白话解释编程术语——变量、函数、DOM、Promise 等等。
相关错误
用大白话解释常见错误——什么意思、为什么发生、如何修复。