e преди 10 месеца
родител
ревизия
a95c71ddbe
променени са 2 файла, в които са добавени 68 реда и са изтрити 0 реда
  1. 38 0
      css/8.元素转换.html
  2. 30 0
      css/9.盒模型.html

+ 38 - 0
css/8.元素转换.html

@@ -0,0 +1,38 @@
+<!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>
+        /* 
+            将元素转成行内元素 display:inline;
+            将元素转成块级元素 display:block;
+            将元素转成行内块级元素 display:inline-block;
+        */
+        .first {
+            width: 300px;
+            height: 300px;
+            display: inline-block;
+            background-color: aqua;
+        }
+        .second {
+            width: 200px;
+            height: 200px;
+            display: inline-block;
+            background-color: #f00;
+        }
+        span {
+            width: 100px;
+            height: 100px;
+            display: block;
+            border: 1px solid #f00;
+        }
+    </style>
+</head>
+<body>
+    <div class="first">111</div>
+    <div class="second">222</div>
+    <span>333</span><span>444</span>
+</body>
+</html>

+ 30 - 0
css/9.盒模型.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>
+        div {
+            width: 200px;
+            height: 200px;
+            border: 2px solid #000;
+            background: #00f;
+            padding: 10px;
+            margin: 10px;
+            box-sizing: border-box;
+            /* box-sizing: content-box; */
+        }
+    </style>
+</head>
+<body>
+    <!-- 
+        盒模型:
+            标准盒模型:box-sizing: content-box
+                width = contentWidth + border + padding;
+            怪异盒模型: box-sizing: border-box
+                width = contentWidth(弹性contentWidth + border + padding)
+     -->        
+    <div></div>
+</body>
+</html>