feat: Add CSS layout exercises and corresponding HTML files

- Created multiple exercises under the CSS layout section, including:
  - Final page layout with CSS styles and HTML structure.
  - Display and flow concepts with examples of block, inline, and none display types.
  - Selectors and pseudo-classes with practical examples.
  - Overflow and sizing handling in CSS.
  - Grid layout basics for two-dimensional layouts.
  - Fixed and sticky positioning examples.
  - Centering techniques for common layout scenarios.

- Added README files for each exercise to outline objectives and file structures.
- Updated main README to include new sections and usage instructions.
This commit is contained in:
chali
2026-03-09 14:16:22 +08:00
commit 4495ae0e28
85 changed files with 2566 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
# 练习 3语义化布局
## 目标
学会把一个页面拆成有意义的结构区域。
## 你要练什么
- `header`
- `nav`
- `main`
- `section`
- `article`
- `aside`
- `footer`
## 任务
请完成一个“个人博客首页结构”,要求包含:
- 页头:博客名称
- 导航:至少 3 个链接
- 主内容区
- 一个“最新文章”分区
- 分区里至少 2 篇 `article`
- 一个侧边栏,写上“关于我”
- 一个页脚
## 检查点
- 页面是否有清晰的区域划分
- `article` 是否适合承载独立内容
- `aside` 是否作为补充信息
- `footer` 是否放在页面结尾
## 文件
- [starter.html](/Volumes/Macintosh HD 1/home/front-end-example/01-html-structure/03-semantic-layout/starter.html)
- [answer.html](/Volumes/Macintosh HD 1/home/front-end-example/01-html-structure/03-semantic-layout/answer.html)

View File

@@ -0,0 +1,43 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>个人博客首页</title>
</head>
<body>
<header>
<h1>小周的前端博客</h1>
<nav>
<a href="#home">首页</a>
<a href="#posts">文章</a>
<a href="#about">关于我</a>
</nav>
</header>
<main>
<section id="posts">
<h2>最新文章</h2>
<article>
<h3>HTML 结构入门</h3>
<p>这篇文章介绍如何用标题、段落和列表搭建页面基础结构。</p>
</article>
<article>
<h3>为什么要写语义化标签</h3>
<p>语义化标签让页面更清晰,也更方便后期维护。</p>
</article>
</section>
<aside id="about">
<h2>关于我</h2>
<p>我是一名正在学习前端的同学,目前专注于 HTML 和 CSS 基础。</p>
</aside>
</main>
<footer>
<p>2026 小周的前端博客</p>
</footer>
</body>
</html>

View File

@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>个人博客首页</title>
</head>
<body>
<!-- 任务:
1. 写 header 和 nav
2. 写 main
3. 在 main 里写一个 section
4. section 里至少放 2 个 article
5. 写 aside 和 footer
-->
</body>
</html>