fengchuanyu 4 dagar sedan
förälder
incheckning
2da9c710e9
4 ändrade filer med 192 tillägg och 0 borttagningar
  1. 54 0
      2-CSS/11_BFC.html
  2. 71 0
      2-CSS/12_行块元素.html
  3. BIN
      2-CSS/image/phone.png
  4. 67 0
      2-CSS/练习3_商品卡.html

+ 54 - 0
2-CSS/11_BFC.html

@@ -0,0 +1,54 @@
+<!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,.box2{
+            width: 200px;
+            height: 200px;
+        }
+        .box1{
+            background-color: red;
+            margin-bottom: 50px;
+        }
+        .box2{
+            background-color: blue;
+            margin-top: 50px;
+        }
+        .box3{
+            /* overflow: hidden; 可以生成一个BFC区域 */
+            overflow: hidden;
+
+        }
+
+        .box4{
+            width: 400px;
+            height: 400px;
+            background-color: red;
+            /* 生成一个BFC区域 */
+            overflow: hidden;
+        }
+        .box5{
+            width: 200px;
+            height: 200px;
+            background-color: blue;
+            margin-top: 50px;
+        }
+    </style>
+</head>
+<body>
+    <!-- 当生成一个BFC区域时,内部元素和外部的元素不会相互影响 内部元素不会超出BFC区域 -->
+    <!-- BFC(块格式化上下文) 外边距合并 -->
+    <!-- <div class="box3">
+        <div class="box1"></div>
+    </div> 
+    <div class="box2"></div> -->
+
+    <!-- BFC(块格式化上下文) 外边距溢出 -->
+    <div class="box4">
+        <div class="box5"></div>
+    </div>
+</body>
+</html>

+ 71 - 0
2-CSS/12_行块元素.html

@@ -0,0 +1,71 @@
+<!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>
+        /* 行块元素 */
+        /* 行元素他的大小是根据内容撑开 */
+        /* 行元素不接受宽高属性 */
+        /* 行元素设置margin 上下无效 左右是有效的 */
+        span{
+            width: 100px;
+            height: 100px;
+            background-color: red;
+            /* margin-top: 10px;
+            margin-bottom: 10px;
+            margin-left: 10px;
+            margin-right: 10px; */
+
+            /* display 转换当前标签的显示模式 */
+            /* block 块元素 */
+            display: block;
+        }
+        .box{
+            width: 100px;
+            height: 100px;
+            background-color: blue;
+            /* inline 行元素 */
+            display: inline;
+        }
+        img{
+            width: 100px;
+        }
+
+        .span1{
+            width: 100px;
+            height: 100px;
+            background-color: rebeccapurple;
+            /* 行块元素 inline-block*/
+            display: inline-block;
+        }
+
+        .box1{
+            width: 100px;
+            border:3px solid black;
+        }
+        img{
+        }
+    </style>
+</head>
+<body>
+    <!-- <div class="box">123</div>
+    <span>hello</span><span>world</span>
+    <div class="box">123</div> -->
+
+    <!-- img标签是行块元素 即具备行元素和块元素的特点 -->
+     <!-- 行块元素特点:多个元素在同一行并且可以设置高度宽度 -->
+    <!-- <img src="./image/phone.png" alt="img">
+    <img src="./image/phone.png" alt="img"> -->
+
+
+    <span class="span1"> hello </span>
+    <span class="span1"> world </span>
+
+    <div class="box1">
+        <img src="./image/img1.jpg" alt="">
+    </div>
+
+</body>
+</html>

BIN
2-CSS/image/phone.png


+ 67 - 0
2-CSS/练习3_商品卡.html

@@ -0,0 +1,67 @@
+<!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>
+        .goods-card{
+            width: 234px;
+            box-shadow: 0 0 5px gray;
+            margin: 100px auto;
+            padding-bottom: 30px;
+        }
+        .goods-pic img{
+            width: 234px;
+        }
+        .goods-title,.goods-info,.goods-price{
+            padding:0 10px;
+        }
+        .goods-title{
+            color: #333;
+            font-size: 14px;
+            font-weight: 400;
+            text-align: center;
+            margin-bottom: 2px;
+        }
+        .goods-info{
+            font-size: 12px;
+            color: #b0b0b0;
+            overflow: hidden;
+            text-overflow: ellipsis;
+            text-wrap: nowrap;
+            margin-bottom: 10px;
+        }
+        .goods-price{
+            text-align: center;
+        }
+        .goods-price span{
+            color: #ff6700;
+            font-size: 14px;
+            font-weight: 400;
+        }
+        .goods-price del{
+            color: #b0b0b0;
+            font-size: 14px;
+            font-weight: 400;
+        }
+    </style>
+</head>
+<body>
+    <div class="goods-card">
+        <div class="goods-pic">
+            <img src="./image/phone.png" alt="phone">
+        </div>
+        <div class="goods-title">
+            <span>REDMI K80</span>
+        </div>
+        <div class="goods-info">
+            第三代骁龙8|2K新国屏|6550mAh 超长续航
+        </div>
+        <div class="goods-price">
+            <span>2299元起</span>
+            <del>2499元</del>
+        </div>
+    </div>
+</body>
+</html>