Forráskód Böngészése

字体文本相关

dongxiuling 2 éve
szülő
commit
c9268d3985
3 módosított fájl, 74 hozzáadás és 0 törlés
  1. 34 0
      css/4_css宽高背景.html
  2. 40 0
      css/5_字体文本相关属性.html
  3. BIN
      css/img01.jpeg

+ 34 - 0
css/4_css宽高背景.html

@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>Document</title>
+    <style>
+        /* 宽高 背景 */
+        div{
+            /* 宽 */
+            width:1000px;
+            /* 高 */
+            height:800px;
+            /* 背景 */
+            background-color:red ;
+            /* 背景图片url(图片地址) */
+            background-image: url(img01.jpeg);
+            /* 背景图片重复 repeat|no-repeat*/
+            background-repeat: no-repeat;
+            /* 背景图片位置 x水平(固定值|left center right) y垂直 (固定值| top center bottom)*/
+            background-position:center center ;
+
+            /* 省略写法 */
+            background: red url(img01.jpeg)  no-repeat center center;
+        }
+
+
+    </style>
+</head>
+<body>
+    <div>我是一个div</div>
+</body>
+</html>

+ 40 - 0
css/5_字体文本相关属性.html

@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>Document</title>
+    <style>
+        div{
+            width:300px;
+            height:50px;
+            background: #f00;
+            /* 字体相关的属性 可以继承的 */
+            /* 字体大小 浏览器中默认字体大小16px;  浏览器支持的最小字体大小12px*/
+            font-size: 16px;
+            /* 字体粗细 100-900 默认值400 */
+            font-weight: 400;
+            /* 字体 */
+            font-family: 'Times New Roman', Times, serif;
+            /* 字体样式  italic斜体|normal正常 */
+            font-style:italic;
+
+
+            /* 文本相关 */
+            /* 水平对齐方式 left right center*/
+            text-align:center ;
+
+            /* 单行文本垂直对齐 行高=高 */
+            line-height:50px ;
+
+        }
+    </style>
+</head>
+<body>
+    <div>
+        我是div1 哈哈哈哈  
+    </div>
+
+</body>
+</html>

BIN
css/img01.jpeg