Blogger Information
Blog 20
fans 0
comment 0
visits 14283
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
css选择器与优先级的学习-2019年1月14日22点52分
kszyd的博客
Original
577 people have browsed it

css几种选择器与优先级实践:

实例

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>CSS常用选择器与优先级</title>
    <style>
       h3 {
           background-color: antiquewhite;
           color: azure;
       }
       /* 类选择器 用.表示*/
       .bj {
           background-color: blueviolet;
           color: brown;
       }
       /* id选择器,用#号表示 */
       #yellow {
           background-color: black;
           color: #000;
       }
     
    </style>
</head>
<body>
    <h3>样式规则,选择器,声明,属性</h3>
    <h3 class="bj">样式规则,选择器,声明,属性</h3>
    <h3 class="bj" id="yellow">样式规则,选择器,声明,属性</h3>
<!-- 选择器层面:标签小于class,.小于id,style级别最高 -->
<!-- 内联样式style优先级大于id -->
</body>
</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例

css选择器:标签直接调用,class,id,style等;其中class可用“.”表示,id的用“#”表示。

优先级:style最高,其次是id、class、标签。

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post