e 1 year ago
parent
commit
78ae7b3a33
3 changed files with 103 additions and 0 deletions
  1. 32 0
      day3/1.css引入.html
  2. 66 0
      day3/2.css中常用样式.html
  3. 5 0
      day3/demo.css

+ 32 - 0
day3/1.css引入.html

@@ -0,0 +1,32 @@
+<!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;
+            background: #00f;
+        }
+    </style>
+    <!-- 
+        link 引入外部样式表
+        rel 挂载关系
+        stylesheet 样式表
+        href 引入路径
+     -->
+    <link rel="stylesheet" href="./demo.css">
+</head>
+<body>
+    <div></div>
+    <!-- 行内样式/内联样式 -->
+    <!-- 
+        优先级:
+        行内样式 > 外部样式表 > 内部样式表
+     -->
+    <!-- <div style="width: 200px;height: 200px;background: #f00;"></div> -->
+</body>
+</html>

+ 66 - 0
day3/2.css中常用样式.html

@@ -0,0 +1,66 @@
+<!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
+               高度: height
+               像素单位:px
+               背景:background 复合属性
+               background:color image repeat position;
+               background-color 背景色
+               background-image:url("路径") 背景图
+               background-repeat 背景平铺
+                    no-repeat 不平铺
+                    repeat-x 横向平铺
+                    repeat-y 纵向平铺
+                    repeat 平铺
+                background-size 背景尺寸
+                 cover 全覆盖
+                 contain 当前盒子最大等比例放大
+                background-position:x轴 y轴; 背景位置
+                    center left right bottom top
+                
+            */
+            width: 800px;
+            height: 800px;
+            background: yellow url("../day1/images/img01.gif")  no-repeat center;
+            /* background-size: contain; */
+            /* background-repeat: repeat; */
+            /* background-color: aqua; */
+            /* background: hotpink; */
+            /* background-position: right bottom; */
+            /* border: 1px solid #000; */
+            /* 边框尺寸 */
+            border-width: 10px;
+            /* 边框样式
+                solid 实线
+                dashed 虚线
+                double 双边框
+                dotted 点线
+            */
+            border-style: dotted;
+            /* 边框颜色 */
+            border-color: red;
+            /* 复合属性:
+                border: width  style color;
+                border-top 上边框
+                border-bottom 下边框
+                border-right 右边框
+                border-left 左边框
+            */
+            border: 2px solid blue;
+            /* 相同样式后面的样式层级会覆盖前面的样式层级 */
+            border-top: 5px dotted red;
+        }
+    </style>
+</head>
+<body>
+    <div></div>
+</body>
+</html>

+ 5 - 0
day3/demo.css

@@ -0,0 +1,5 @@
+div {
+    width: 200px;
+    height: 200px;
+    background: #0f0;
+}