CSS 自测题 -- 用柔性布局绘制骰子(一、二、三[带对角线三点]、四、五、六点) - 2 分
最编程
2024-03-03 19:23:14
...
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>css flex布局-画骰子</title>
<style>
.box {
margin: 20px;
height: 100px;
width: 100px;
border: 2px solid grey;
border-radius: 10px;
/* 容器内元素使用flex布局 */
display: flex;
/* 主轴改为纵向 */
flex-direction: column;
/* 主轴(纵向)绝对均匀对齐(子元素间距以及两端边缘间距都相等) */
justify-content: space-evenly;
/* 交叉轴(横向)居中对齐 */
align-items: center;
}
.point {
border-radius: 50%;
height: 20px;
width: 20px;
background: black;
}
</style>
</head>
<body>
<div class="box">
<div class="point"></div>
<div class="point"></div>
</div>
</body>
</html>