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:
31
02-css-layout/02-box-model-card/README.md
Normal file
31
02-css-layout/02-box-model-card/README.md
Normal file
@@ -0,0 +1,31 @@
|
||||
# 练习 2:盒模型卡片
|
||||
|
||||
## 目标
|
||||
|
||||
彻底理解 `margin`、`padding`、`border` 的区别。
|
||||
|
||||
## 你要练什么
|
||||
|
||||
- `width`
|
||||
- `padding`
|
||||
- `border`
|
||||
- `margin`
|
||||
- `border-radius`
|
||||
- `box-shadow`
|
||||
|
||||
## 任务
|
||||
|
||||
请把一个课程卡片做出来,要求:
|
||||
|
||||
- 卡片和页面边缘有距离
|
||||
- 卡片内部文字和边框有距离
|
||||
- 卡片有边框和圆角
|
||||
- 卡片有轻微阴影
|
||||
- 按钮区域和正文之间有明显间隔
|
||||
|
||||
## 文件
|
||||
|
||||
- [starter.html](/Volumes/Macintosh HD 1/home/front-end-example/02-css-layout/02-box-model-card/starter.html)
|
||||
- [starter.css](/Volumes/Macintosh HD 1/home/front-end-example/02-css-layout/02-box-model-card/starter.css)
|
||||
- [answer.html](/Volumes/Macintosh HD 1/home/front-end-example/02-css-layout/02-box-model-card/answer.html)
|
||||
- [answer.css](/Volumes/Macintosh HD 1/home/front-end-example/02-css-layout/02-box-model-card/answer.css)
|
||||
37
02-css-layout/02-box-model-card/answer.css
Normal file
37
02-css-layout/02-box-model-card/answer.css
Normal file
@@ -0,0 +1,37 @@
|
||||
body {
|
||||
margin: 0;
|
||||
background: #eef2ff;
|
||||
font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
|
||||
}
|
||||
|
||||
.course-card {
|
||||
width: 360px;
|
||||
margin: 56px auto;
|
||||
padding: 28px;
|
||||
border: 1px solid #c7d2fe;
|
||||
border-radius: 20px;
|
||||
background: #ffffff;
|
||||
box-shadow: 0 16px 40px rgba(37, 99, 235, 0.12);
|
||||
}
|
||||
|
||||
.tag {
|
||||
display: inline-block;
|
||||
margin: 0;
|
||||
padding: 6px 12px;
|
||||
border-radius: 999px;
|
||||
background: #dbeafe;
|
||||
color: #1d4ed8;
|
||||
}
|
||||
|
||||
.actions {
|
||||
margin-top: 24px;
|
||||
}
|
||||
|
||||
a {
|
||||
display: inline-block;
|
||||
padding: 10px 18px;
|
||||
border-radius: 10px;
|
||||
background: #1d4ed8;
|
||||
color: #ffffff;
|
||||
text-decoration: none;
|
||||
}
|
||||
20
02-css-layout/02-box-model-card/answer.html
Normal file
20
02-css-layout/02-box-model-card/answer.html
Normal file
@@ -0,0 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>盒模型卡片</title>
|
||||
<link rel="stylesheet" href="./answer.css" />
|
||||
</head>
|
||||
<body>
|
||||
<article class="course-card">
|
||||
<p class="tag">HTML 基础</p>
|
||||
<h1>前端入门训练营</h1>
|
||||
<p>从 HTML 结构开始,逐步学习 CSS 布局和 JavaScript 基础。</p>
|
||||
|
||||
<div class="actions">
|
||||
<a href="#">立即报名</a>
|
||||
</div>
|
||||
</article>
|
||||
</body>
|
||||
</html>
|
||||
14
02-css-layout/02-box-model-card/starter.css
Normal file
14
02-css-layout/02-box-model-card/starter.css
Normal file
@@ -0,0 +1,14 @@
|
||||
body {
|
||||
}
|
||||
|
||||
.course-card {
|
||||
}
|
||||
|
||||
.tag {
|
||||
}
|
||||
|
||||
.actions {
|
||||
}
|
||||
|
||||
a {
|
||||
}
|
||||
20
02-css-layout/02-box-model-card/starter.html
Normal file
20
02-css-layout/02-box-model-card/starter.html
Normal file
@@ -0,0 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>盒模型卡片</title>
|
||||
<link rel="stylesheet" href="./starter.css" />
|
||||
</head>
|
||||
<body>
|
||||
<article class="course-card">
|
||||
<p class="tag">HTML 基础</p>
|
||||
<h1>前端入门训练营</h1>
|
||||
<p>从 HTML 结构开始,逐步学习 CSS 布局和 JavaScript 基础。</p>
|
||||
|
||||
<div class="actions">
|
||||
<a href="#">立即报名</a>
|
||||
</div>
|
||||
</article>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user