fengchuanyu 1 周之前
父節點
當前提交
f868c46b6e
共有 2 個文件被更改,包括 134 次插入0 次删除
  1. 92 0
      5-CSS3/8_flex.html
  2. 42 0
      5-CSS3/练习4_骰子.html

+ 92 - 0
5-CSS3/8_flex.html

@@ -0,0 +1,92 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>Document</title>
+    <style>
+        .box div{
+            width: 200px;
+            height: 200px;
+            background-color: red;
+            margin:10px;
+            font-size: 50px;
+            font-weight: bold;
+            color: white;
+            text-align: center;
+            line-height: 200px;
+        }
+        .box{
+            height: 700px;
+            background-color: blue;
+            /* display: flex; 把当前容器设置成弹性盒子(flex布局) */
+            /* 默认情况下会将内部所有元素在主轴上横向排列 (主轴方向默认横向) */
+            display: flex;
+            /* 调整主轴方向 row 横向 column 纵向 */
+            /* flex-direction: column; */
+            /* row-reverse 横向反转 column-reverse 纵向反转 */
+            /* flex-direction: row-reverse; */
+            /* flex-wrap: wrap  换行 */
+            /* flex布局默认情况  元素不换行  如果一行装不下会压缩元素 */
+            /* flex-wrap: wrap; */
+            /* justify-content  主轴对齐方式 flex-start flex-end center */
+            /* space-between  两端对齐 space-around 分散对齐 */
+            /* justify-content: space-around; */
+            /* justify-content: space-between; */
+            /* justify-content: center; */
+            /* 交叉轴排列方式  flex-start flex-end center */
+            /* align-items: stretch; */
+
+            /* aligin-content 控制多行对齐 */
+            /* align-content: space-between; */
+
+        }
+
+        /* 用于每一个子项上的属性 */
+
+        /* order  子项的排序  值越小越靠前 值越大越靠后*/
+        /* .box div:nth-child(3){
+            order: -1;
+        }
+        .box div:first-child{
+            order: 10;
+        } */
+
+        /* flex-grow  子项的放大比例 */
+        /* flex-grow 会把剩余空间进行分配 子项 flex-grow 比例分配 */
+        /* .box div:nth-child(4){
+            flex-grow: 2;
+        }
+        .box div:nth-child(3){
+            flex-grow: 1;
+        } */
+
+        /* flex-shrink  子项的缩小比例 */
+        /* flex-shrink 会把超出空间进行压缩 子项 flex-shrink 比例压缩 */
+
+        /* .box div:nth-child(3){
+            flex-shrink: 0;
+        } */
+
+        .box div{
+            /* flex:0 0 200px; */
+        }
+
+        .box div:nth-child(2){
+            align-self: flex-end;
+        }
+    </style>
+</head>
+<body>
+    <div class="box">
+        <div>1</div>
+        <div>2</div>
+        <div>3</div>
+        <!-- <div>4</div>
+        <div>5</div>
+        <div>6</div>
+        <div>7</div>
+        <div>8</div> -->
+    </div>
+</body>
+</html>

+ 42 - 0
5-CSS3/练习4_骰子.html

@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<html lang="en">
+
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>Document</title>
+    <style>
+        .face {
+            float: left;
+            margin: 16px;
+            padding: 4px;
+            background-color: #e7e7e7;
+            width: 104px;
+            height: 104px;
+            box-shadow: inset 0 5px white, inset 0 -5px #bbb, inset 5px 0 #d7d7d7, inset -5px 0 #d7d7d7;
+            border-radius: 10%;
+        }
+
+        .face span {
+            display: block;
+            width: 24px;
+            height: 24px;
+            border-radius: 50%;
+            margin: 4px;
+            background-color: #333;
+            box-shadow: inset 0 3px #111, inset 0 -3px #555;
+        }
+
+        
+    </style>
+</head>
+
+<body>
+    <div class="face face1">
+        <span></span>
+    </div>
+
+    
+</body>
+
+</html>