Ver Fonte

fix:css

e há 1 mês atrás
pai
commit
99feea18cf
2 ficheiros alterados com 146 adições e 0 exclusões
  1. 37 0
      2.css/4.文字样式.html
  2. 109 0
      2.css/5.案例准备.html

+ 37 - 0
2.css/4.文字样式.html

@@ -0,0 +1,37 @@
+<!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>
+        /* 
+            浏览器默认(根)字体大小16px
+            浏览器最小: 12px
+        */
+        p {
+            /* 字体大小 */
+            font-size: 30px;
+            /* 字体粗细:
+               粗: bold  bolder 600-900
+               正常:normal 400 500
+               细: lighter 100-300
+            */
+            font-weight: bold;
+            /* 
+                字体样式
+                italic 倾斜
+                normal 正常
+            */
+            font-style: italic;
+            /* 字体 */
+            font-family: 'Courier New', Courier, monospace;
+        }
+    </style>
+  </head>
+  <body>
+    <div>
+      <p>今天天气真好</p>
+    </div>
+  </body>
+</html>

+ 109 - 0
2.css/5.案例准备.html

@@ -0,0 +1,109 @@
+<!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: 800px;
+            height: 800px;
+            border: 2px solid #000;
+        }
+        #part1 {
+            width: 200px;
+            height: 200px;
+            color: #f00;
+            font-size: 35px;
+            font-weight: bold;
+            background: #ff0;
+            display: inline-block;
+            /*想让文字 在 已知宽高的盒子 内 居中*/
+            text-align: center;
+            /* 间隔 */
+            line-height: 200px;
+        }
+        #part1:hover {
+            color: #fff;
+            background-color: #000;
+
+        }
+        #part2 {
+            width: 200px;
+            height: 200px;
+            color: #ff0;
+            font-size: 35px;
+            font-weight: bold;
+            background: #00f;
+            display: inline-block;
+            /*想让文字 在 已知宽高的盒子 内 居中*/
+            text-align: center;
+            /* 间隔 */
+            line-height: 200px;
+        }
+        /* 
+        
+            将块级元素转成行内元素
+            display:inline
+            将元素转成行内块元素
+            display:inline-block
+            将元素转成行块元素
+            display: block;
+        */
+        span {
+            font-size: 22px;
+        }
+        /* 伪类选择器
+            :hover 滑过
+            :first-child 第一个子类
+            :last-child 最后一个子类
+            :nth-child(n) 自定义子类
+            even 偶数 2n
+            odd 奇数 2n+1
+        */
+        ul {
+            /* 取消列表默认样式 */
+            list-style: none;
+        }
+        ul li a {
+            /* 取消a标签的默认样式 */
+            text-decoration: none;
+            color: #000;
+        }
+        ul li:first-child a {
+            color: plum;
+        }
+        ul li:last-child a {
+            color: blue;
+        }
+        ul li:nth-child(2n+1) a {
+            color: #0f0;
+        }
+        ul li:nth-child(2n+1):hover a {
+            color: #ff0;
+        }
+        ul li:hover a {
+            color: red;
+        }
+    </style>
+</head>
+<body>
+    <div class="box">
+        <div id="part1">
+            你好
+        </div>
+        <div id="part2">
+            <span>1</span>
+            <span>2</span>
+        </div>
+        <ul>
+            <li><a href="">你好</a></li>
+            <li><a href="">你好</a></li>
+            <li><a href="">你好</a></li>
+            <li><a href="">你好</a></li>
+            <li><a href="">你好</a></li>
+            <li><a href="">你好</a></li>
+        </ul>
+    </div>
+</body>
+</html>