# 文档类型<!DOCTYPE>

<!DOCTYPE html> 

# 字符集

<meta charset="UTF-8" />

# 换行标签

<br />

# div span标签

 

 

后代选择器  子代选择器 >

交集选择器 

div.one{

}

并集选择器

 

行内元素和块级元素的区别

CSS魔法(二)

块级元素:独占一行 能设置大小

行内元素:不能设置大小   display:inline-block可将行内元素转为块级元素

 

行高 line-height 文字居中

<style>
        div {
            height: 50px;
            width: 200px;
            background-color: pink;
            line-height: 50px;
        }
</style>
<div>我是行高</div>

CSS魔法(二)

 权重

CSS魔法(二)

  权重值

CSS魔法(二)

<!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>
View Code

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-04
  • 2021-12-05
  • 2021-04-15
  • 2021-09-29
  • 2021-11-21
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-08-25
  • 2022-12-23
  • 2018-06-04
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案