fengchuanyu hace 14 horas
padre
commit
646f8f114f

+ 29 - 0
2_CSS/40_用定控制元素大小.html

@@ -0,0 +1,29 @@
+<!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{
+            width: 200px;
+            height: 200px;
+            border: 1px solid #000;
+            position: relative;
+        }
+        .item{
+            background-color: red;
+            position: absolute;
+            top:0;
+            left:0;
+            right: 0;
+            bottom: 0;
+        }
+    </style>
+</head>
+<body>
+    <div class="box">
+        <div class="item"></div>
+    </div>
+</body>
+</html>

+ 34 - 0
2_CSS/41_定位元素调整层级.html

@@ -0,0 +1,34 @@
+<!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>
+        .box1{
+            width: 200px;
+            height: 200px;
+            background-color: red;
+            position:absolute;
+            top: 0;
+            left: 0;
+            /* z-index 只有定位元素才有效 */
+            /* z-index 调整定位层级,默认值为0 ,数字越大层级越高 */
+            z-index: 1;
+        }
+        .box2{
+            width: 200px;
+            height: 200px;
+            background-color: blue;
+            position:absolute;
+            top: 10px;
+            left: 0;
+            z-index: 2;
+        }
+    </style>
+</head>
+<body>
+    <div class="box1"></div>
+    <div class="box2"></div>
+</body>
+</html>

+ 30 - 0
2_CSS/42_新颜色格式_透明.html

@@ -0,0 +1,30 @@
+<!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{
+            width: 100px;
+            height: 100px;
+            /* rgb (red green blue) 取之范围 0-255 */
+            /* background-color: rgb(255,255,255); */
+            /* hsl (色相,饱和度,亮度) 0-360 0-100 0-100 */
+            /* background-color: hsl(); */
+            /* rgba (red green blue alpha) 0-255 0-1 0-1 0-1 alpha(透明度) 0表示透明 1表示不透明 */
+            /* background-color: rgba(133, 121, 121, 0.2); */
+
+            background-color: red;
+            /* 当前整个元素的透明度  0-1 0表示透明 1表示不透明 */
+            /* css中如果出现0.开头的数字,0可以省略不写 */
+            opacity: .2;
+        }
+    </style>
+</head>
+<body>
+    <div class="box">
+        hello world
+    </div>
+</body>
+</html>

+ 93 - 0
2_CSS/练习10_定位气泡.html

@@ -0,0 +1,93 @@
+<!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>
+        /* css reset */
+        * {
+            margin: 0;
+            padding: 0;
+        }
+
+
+        .fullscreen-container {
+            /* height: 100vh;
+            width: 100vw; */
+            background-color: #f0f4c3;
+            position: fixed;
+            top: 0;
+            left: 0;
+            right: 0;
+            bottom: 0;
+        }
+        .bubble-container{
+            width: 500px;
+            height: 600px;
+            background-color: #fff;
+            z-index: 1000;
+            position: fixed;
+            top: 50%;
+            left: 50%;
+            margin-top: -300px;
+            margin-left: -250px;
+            padding: 20px;
+            box-sizing: border-box;
+        }
+        .bottom-info{
+            /* 如果块元素定位后fixed 和 absolute宽度会变成内容的宽*/
+            position: fixed;
+            bottom: 0;
+            left: 0;
+            height: 50px;
+            width: 100%;
+            text-align: center;
+            line-height: 50px;
+            color: #b28704;
+            background-color: #fffde7;
+        }
+        .bubble-container .text{
+            text-align: center;
+        }
+        .bubble-container .text h1{
+            color: #689f38;
+            margin:20px 0;
+        }
+        .bubble-container .text .info {
+            width: 300px;
+            margin: 0 auto;
+        }
+        .bubble-container .text .desc {
+            font-size: 12px;
+            color: #999;
+            margin-top: 20px;
+        }
+        .bubble-container .bubble-content{
+            width: 100%;
+            height: 380px;
+            background-color:#b2dfdb;
+            margin-top: 20px;
+            border-radius: 20px;
+        }
+    </style>
+</head>
+
+<body>
+    <!-- 全屏容器 -->
+    <div class="fullscreen-container"></div>
+    <!-- 定位气泡容器 -->
+    <div class="bubble-container">
+        <div class="text">
+            <h1>趣味气泡 Position 练习</h1>
+            <p class="info">任务: 观察并理解气泡的定位方式,鼠标悬停气泡试试看!</p>
+            <p class="desc">(气泡用 absolute,气泡区用 relative,底部说明条用 fixed)</p>
+        </div>
+        <div class="bubble-content"></div>
+    </div>
+    <!-- 底部信息 -->
+    <div class="bottom-info">本页面用于练习 position: relative / absolute / fixed 及 hover/伪元素效果</div>
+</body>
+
+</html>

+ 0 - 0
2_CSS/练习8_小米登录.html → 2_CSS/练习9_小米登录.html