1 Star 0 Fork 0

prcool/前端开发学习

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
flex.html 5.69 KB
一键复制 编辑 原始数据 按行查看 历史
prcool 提交于 2021-09-11 21:06 +08:00 . 前端开发学习
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>flex 布局练习</title>
<style>
* {
box-sizing: border-box;
}
html, body {
height: 100%;
}
body {
display: flex;
align-items: center;
justify-content: center;
vertical-align: center;
flex-wrap: wrap;
align-content: center;
font-family: 'Open Sans', sans-serif;
background: linear-gradient(top, #222, #333);
}
[class$="face"] {
margin: 16px;
padding: 4px;
background-color: #e7e7e7;
width: 104px;
height: 104px;
object-fit: contain;
box-shadow: inset 0 5px white,
inset 0 -5px #bbb,
inset 5px 0 #d7d7d7,
inset -5px 0 #d7d7d7;
border-radius: 10%;
}
.pip {
display: block;
width: 24px;
height: 24px;
border-radius: 50%;
margin: 4px;
background-color: #333;
box-shadow: inset 0 3px #111, inset 0 -3px #555;
}
.first-face {
display: flex;
}
.second-face {
display: flex;
justify-content: space-between;
}
.third-face {
display: flex;
flex-direction: column;
justify-content: space-between;
}
.four-face {
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
}
.five-face {
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: flex-end;
}
.six-face{
display:flex;
}
.six-face .pip:nth-child(2){
align-self:center;
}
.seven-face{
display:flex;
justify-content: space-between;
}
.seven-face .pip:nth-child(2){
align-self:flex-end;
}
.eight-face{
display:flex;
}
.eight-face .pip:nth-child(2){
align-self:center;
}
.eight-face .pip:nth-child(3){
align-self:flex-end;
}
.nine-face{
display:flex;
justify-content: flex-end;
flex-wrap:wrap;
}
.nine-face .pip:nth-child(4){
align-self:flex-end;
}
.ten-face{
display:flex;
flex-wrap:wrap;
align-content: space-between;
}
.ten-face .column{
flex-basis:100%;
/*flex-grow:1;*/
display:flex;
justify-content: space-between;
}
.eleven-face{
display:flex;
flex-wrap:wrap;
align-items: space-between;
}
.eleven-face .column{
display:flex;
flex-basis:100%;
}
.twelve-face{
display:flex;
flex-wrap:wrap;
flex-direction: column;
align-content: space-between;
}
.thirteen-face{
display:flex;
flex-wrap:wrap;
align-content: space-between;
}
.thirteen-face .column{
display:flex;
flex-basis:100%;
}
.thirteen-face .column:nth-child(2){
justify-content: center;
}
.thirteen-face .column:nth-child(3){
justify-content: space-between;
}
</style>
</head>
<body>
<div class="first-face">
<span class="pip"></span>
</div>
<div class="second-face">
<span class="pip"></span>
<span class="pip"></span>
</div>
<div class="third-face">
<span class="pip"></span>
<span class="pip"></span>
</div>
<div class="four-face">
<span class="pip"></span>
<span class="pip"></span>
</div>
<div class="five-face">
<span class="pip"></span>
<span class="pip"></span>
</div>
<div class="six-face">
<span class="pip"></span>
<span class="pip"></span>
</div>
<div class="seven-face">
<span class="pip"></span>
<span class="pip"></span>
</div>
<div class="eight-face">
<span class="pip"></span>
<span class="pip"></span>
<span class="pip"></span>
</div>
<div class="nine-face">
<span class="pip"></span>
<span class="pip"></span>
<span class="pip"></span>
<span class="pip"></span>
</div>
<div class="ten-face">
<div class="column">
<span class="pip"></span>
<span class="pip"></span>
</div>
<div class="column">
<span class="pip"></span>
<span class="pip"></span>
</div>
</div>
<div class="eleven-face">
<div class="column">
<span class="pip"></span>
<span class="pip"></span>
<span class="pip"></span>
</div>
<div class="column">
<span class="pip"></span>
<span class="pip"></span>
<span class="pip"></span>
</div>
</div>
<div class="twelve-face">
<div class="column">
<span class="pip"></span>
<span class="pip"></span>
<span class="pip"></span>
</div>
<div class="column">
<span class="pip"></span>
<span class="pip"></span>
<span class="pip"></span>
</div>
</div>
<div class="thirteen-face">
<div class="column">
<span class="pip"></span>
<span class="pip"></span>
<span class="pip"></span>
</div>
<div class="column">
<span class="pip"></span>
</div>
<div class="column">
<span class="pip"></span>
<span class="pip"></span>
</div>
</div>
</body>
</html>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/prcool/front-end-development-learning.git
git@gitee.com:prcool/front-end-development-learning.git
prcool
front-end-development-learning
前端开发学习
master

搜索帮助