批改状态:合格
老师批语:写的不错,下次一天的作业合在一块写!
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>上下文选择器</title><style>/* 后代选择器 空格表示 */.h3-title div {border: 1px solid lightskyblue;}/* 父子选择器 > 没有孙子的份*//* body div { *//* border: 5px solid coral; *//* } *//* 这样写 */body > div {border: 5px solid coral;}/* 同级相邻选择器 */.wsp.center + .wsp {background-color: lightgreen;}/* 同级所有选择器 */.wsp.center ~ .wsp {background-color: magenta;}</style></head><body><div class="h3-title"><div class="wsp" id="first">我是第1行</div><div class="wsp">我是第2行</div><div class="wsp">我是第3行</div><div class="wsp">我是第4行</div><div class="wsp center">我是第5行</div><div class="wsp">我是第6行</div><div class="wsp">我是第7行</div><div class="wsp">我是第8行</div><div class="wsp">我是第9行</div></div></body></html>
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号