最终挑战
Coddy 如何使用 CSS 居中 div 或文本 课程的第 9 课,共 9 课。
我们来回顾一下所有内容!
挑战
简单使用 flexbox,将 text 类在 box2 类中居中,并将 box2 的 div 元素在 box1 类中居中。
亲手试试
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="box1">
<div class="box2">
<p class="text">
A
</p>
</div>
<div class="box2">
<p class="text">
B
</p>
</div>
</div>
</body>
</html>如何使用 CSS 居中 div 或文本中的所有课
自己练习: Web 在线编辑器