一点
<! 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;
display : flex;
justify-content : center;
}
.point {
border-radius : 50%;
height : 20px;
width : 20px;
background : black;
align-self : center;
}
</ style>
</ head>
< body>
< div class = " box" >
< div class = " point" > </ div>
</ div>
</ body>
</ html>
两点
<! 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;
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>
三点
简易版
<! 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;
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 class = " point" > </ div>
</ div>
</ body>
</ html>
复杂版
<! 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;
padding : 10px;
box-sizing : border-box;
display : flex;
justify-content : space-between;
}
.point {
border-radius : 50%;
height : 20px;
width : 20px;
background : black;
}
.point:nth-child(2) {
align-self : center;
}
.point:nth-child(3) {
align-self : flex-end;
}
</ style>
</ head>
< body>
< div class = " box" >
< div class = " point" > </ div>
< div class = " point" > </ div>
< div class = " point" > </ div>
</ div>
</ body>
</ html>
四点
<! 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;
padding : 10px;
box-sizing : border-box;
display : flex;
flex-direction : column;
justify-content : space-evenly;
}
.row {
display : flex;
justify-content : space-evenly;
}
.point {
border-radius : 50%;
height : 20px;
width : 20px;
background : black;
}
</ style>
</ head>
< body>
< div class = " box" >
< div class = " row" >
< div class = " point" > </ div>
< div class = " point" > </ div>
</ div>
< div class = " row" >
< div class = " point" > </ div>
< div class = " point" > </ div>
</ div>
</ div>
</ body>
</ html>
五点
<! 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;
padding : 10px 16px;
box-sizing : border-box;
display : flex;
flex-direction : column;
justify-content : space-evenly;
}
.row1 {
display : flex;
justify-content : space-between;
}
.row2 {
display : flex;
justify-content : center;
}
.point {
border-radius : 50%;
height : 20px;
width : 20px;
background : black;
}
</ style>
</ head>
< body>
< div class = " box" >
< div class = " row1" >
< div class = " point" > </ div>
< div class = " point" > </ div>
</ div>
< div class = " row2" >
< div class = " point" > </ div>
</ div>
< div class = " row1" >
< div class = " point" > </ div>
< div class = " point" > </ div>
</ div>
</ div>
</ body>
</ html>
六点
<! 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;
padding : 10px 16px;
box-sizing : border-box;
display : flex;
flex-direction : column;
justify-content : space-between;
}
.row {
display : flex;
justify-content : space-evenly;
}
.point {
border-radius : 50%;
height : 20px;
width : 20px;
background : black;
}
</ style>
</ head>
< body>
< div class = " box" >
< div class = " row" >
< div class = " point" > </ div>
< div class = " point" > </ div>
</ div>
< div class = " row" >
< div class = " point" > </ div>
< div class = " point" > </ div>
</ div>
< div class = " row" >
< div class = " point" > </ div>
< div class = " point" > </ div>
</ div>
</ div>
</ body>
</ html>