<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
body{
background-color: skyblue;
}
ul{
background-color: whitesmoke;
list-style: none;
padding: 0;
width: 90px;
height: 90px;
border: 1px solid gray;
float: left;
margin: 10px;
border-radius: 10px;
/* 開啟彈性布局 */
display: flex;
}
li{
width: 20px;
height: 20px;
margin: 5px;
background-color: gray;
border-radius: 50%;
}
/* 二號 水平居中 */
ul:nth-child(2){
justify-content: center;
}
/* 三號 靠右 */
ul:nth-child(3){
justify-content: flex-end;
}
/* 四號 靠右 上下居中 */
ul:nth-child(4){
justify-content: flex-end;
align-items: center;
}
/* 5號 左右居中 上下居中 */
ul:nth-child(5){
justify-content: center;
align-items: center;
}
/* 6號 左右 靠邊 */
ul:nth-child(6){
justify-content: space-between;
}
/* 7號 左右 靠邊 第二個色子 在最下方 */
ul:nth-child(7){
justify-content: space-between;
}
ul:nth-child(7) li:nth-child(2){
align-self: flex-end;
}
/* 8號 中間的色子 左右 上下居中 第三個 在右下角 */
ul:nth-child(8){
justify-content: space-between;
}
ul:nth-child(8) li:nth-child(2){
align-self: center;
}
ul:nth-child(8) li:nth-child(3){
align-self: flex-end;
}
/* 9號 從上往下排布 */
ul:nth-child(9){
justify-content: space-between;
flex-direction: column;
}
/* 10號 從上往下排布 */
ul:nth-child(10){
flex-wrap: wrap;
justify-content: space-between;
align-content: space-between;
}
ul:nth-child(10) li{
margin: 10px;
}
/* 11號 從上往下排布 */
ul:nth-child(11){
flex-wrap: wrap;
justify-content: space-between;
align-content: space-between;
}
ul:nth-child(11) li{
margin: 5px 10px;
}
ul:nth-child(11) li:nth-child(3){
margin: 5px 35px;
}
/* 11號 從上往下排布 */
ul:nth-child(12){
flex-wrap: wrap;
flex-direction: column;
align-content: space-around;
}
ul:nth-child(12) li{
/*margin: 5px 10px;*/
}
ul:nth-child(12) li:nth-child(3){
/*margin: 5px 35px;*/
}
/* 11號 從上往下排布 */
ul:nth-child(13){
flex-wrap: wrap;
/*flex-direction: column;*/
align-content: space-around;
}
ul:nth-child(13) li{
/*margin: 5px 10px;*/
}
ul:nth-child(13) li:nth-child(3){
/*margin: 5px 35px;*/
}
</style>
</head>
<body>
<ul>
<li></li>
</ul>
<ul>
<li></li>
</ul>
<ul>
<li></li>
</ul>
<ul>
<li></li>
</ul>
<ul>
<li></li>
</ul>
<ul>
<li></li>
<li></li>
</ul>
<ul>
<li></li>
<li></li>
</ul>
<ul>
<li></li>
<li></li>
<li></li>
</ul>
<ul>
<li></li>
<li></li>
<li></li>
</ul>
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</body>
</html>
flex布局 篩子
?著作權歸作者所有,轉載或內容合作請聯系作者
- 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人,你說我怎么就攤上這事。” “怎么了?”我有些...
- 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著,像睡著了一般。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發上,一...
- 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了?” 一聲冷哼從身側響起,我...
推薦閱讀更多精彩內容
- 一、效果:兩邊固定,中間自適應的三欄布局 二、代碼 1、圣杯布局 2、雙飛翼布局 3、Flex布局 4、Grid布...
- 圣杯布局和雙飛翼布局的目的,都是左右兩欄固定寬度,中間部分自適應。示例目標:左200px,右100px,中間自適應...
- flex布局分為容器的設置和容器內成員的設置,容器的設置是管理成員的排列方式,也就是管理排列的方向和對齊的位置。成...