<!DOCTYPE html> <html> <head> <title>高级选择器</title> <link rel="stylesheet" type="text/css" href="css/index.css"> </head> <body> <h3>我是朱靖,我在这里吃炸鸡</h3> <div class=‘wrap‘> <p> <a href="#">朱靖</a> </p> <a href="http://www.baidu.com">赵晓迪</a> </div> <div class="li"> <a href="#">李凤英</a> </div> <span>在干嘛呢?</span> <span>hello 朱靖</span> </body> </html>
选择符{ 样式; } dive{ color: red; font-size:30px; } */ /* css选择器: 一.基础选择器 -标签(元素)选择器 -类(class)选择器 -id(身份证号)选择器 二.高级选择器 -后代选择器 -子代选择器 -组合选择器 -交集选择器 -伪类选择器 */ p{ color: orange; font-size: 14px; font-weight: bold; } #张磊{ color: blue; } #高领{ color: green; } .active{ color: black; } .title{ font-size: 30px } .lv{ color: green; } .big{ font-size: 20px; } .bold{ font-weight: bold; } /*后代选择器 .wrap>a{ color:purple; } .li a{ color: red; } p,h3,span{ color:gray; font-size: 30px }*/ /*访问过后的a的状态*/ a:visited{ color: green; } /*访问时的a的状态*/ a:hover{ color: orange; } a:acitve{ color: grey; } span{ color: gray; } span:hover{ color: yellow; } div:hover{ background-color:yellow; }
原文:https://www.cnblogs.com/zhujing666/p/12327263.html