<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<link rel="stylesheet" href="./index.css" />
<!-- 需求1:通过ul找到诗句'顿失滔滔',字体变红色 -->
<style>
ul .s1{color: red;}
</style>
<!-- 需求2:通过class属性值‘l1’ 找到下面所有的兄弟,加背景色绿色-->
<style>
.l1~li{background-color: green;}
</style>
<!-- 需求3:诗句的第一句一直是红色 -->
<style>
li:first-of-type{color: red;}
</style>
<!-- 需求4:除了l1,所有的诗句字体变大25px -->
<style>
li:not(.l1),p{font-size: 25px;}
</style>
<!-- 选择器的权重问题 -->
<body&
css练习题
最新推荐文章于 2024-07-17 18:42:40 发布