Blogger Information
Blog 40
fans 2
comment 1
visits 38931
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
2.CSS选择器与优先级-2019年01月14号
万物皆对象
Original
626 people have browsed it

实例:以下是CSS样式经常用到的选择器方式

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>2.CSS常用选择器与优先级</title>
    <style>
        /* 标签选择器 */
        h3{
            background: red;
            color: wheat;
        }
        /* 类class选择器 */
        .bg-blue{
            background: lightblue;
            color: yellow;
        }
        /* id选择器 */
        #bg-yellow{
            background: yellowgreen;
        }
    </style>
</head>
<body>
    <!-- 内联样式style属性优先级大于id选择器 -->
    <h3 style="background-color:lightgreen;color:white">样式规则 = 选择器 + 声明</h3>
    <hr>
    <!-- id选择器大于class类选择器 -->
    <h3 class="bg-blue" id="bg-yellow">样式规则 = 选择器 + 声明</h3> 
</body>
</html>

运行实例 »

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


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