# 文档类型<!DOCTYPE>
<!DOCTYPE html>
# 字符集
<meta charset="UTF-8" />
# 换行标签
<br />
# div span标签
后代选择器 子代选择器 >
交集选择器
div.one{
}
并集选择器
行内元素和块级元素的区别
块级元素:独占一行 能设置大小
行内元素:不能设置大小 display:inline-block可将行内元素转为块级元素
行高 line-height 文字居中
<style> div { height: 50px; width: 200px; background-color: pink; line-height: 50px; } </style> <div>我是行高</div>
权重
权重值
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <style> #ya { /*权重 0,1,0,0*/ color: blue; } .yase { /* 类选择器权重 高于 标签选择器 权重 0, 0, 1, 0*/ color: green; } div { /* 权重 0, 0, 0, 1*/ /* 权重 0, 0, 0, 1*/ color: red; } div { /* 权重 0, 0, 0, 1*/ /* 权重 0, 0, 0, 1*/ color: hotpink!important; } * { 0 0 0 0 } /** 0000 div 0001 .one 0010 #two 0100 行内 1000 important ∞*/ </style> </head> <body> <div class="yase" id="ya" style="color: orange">亚瑟</div> </body> </html>