批改状态:合格
老师批语:作业已检查!
完成的很不错!!
继续保持!!!

<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<meta charset="UTF-8">
<title>3月21作业</title>
<style>
p{
background-color: yellow;
}
#p1{
background-color: red;
}
.div1{
color: red;
}
div p{
background-color:goldenrod;
color: yellow;
}
/* div * {
background-color:red;
}
div > p{
background-color:goldenrod;
}*/
</style>
</head>
<body>
<p id="p1">3月21作业</p>
<p>3月21作业</p>
<div>
<p>3月21作业</p><br>
<p>3月21作业</p>
</div>
<div class="div1">3月21作业</div>
<div>3月21作业</div>
</body>
</html>点击 "运行实例" 按钮查看在线实例
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<meta charset="UTF-8">
<title>属性选择器</title>
<style>
*[id]{
background-color: red;
}
/*根据属性名和值选择的类样式的元素*/
div[id="div3"]{
background-color: green;
}
/*选择属性中包含指定单词的类样式的元素*/
div[id ~="df1"]{
background-color: yellow;
}
/*选择以特定字母开头的类样式的元素*/
div[id ^="divdg"]{
background-color: red;
}
/*选择以特定字母结尾的类样式的元素*/
div[id $="f"]{
background-color: black;
}
/*选择属性值中包括指定字母的类样式的元素*/
div[id *="d1"]{
background-color: black;
}
</style>
</head>
<body>
<div id="div2">属性选择器</div>
<div id="div3">属性选择器</div>
<div id="div2">属性选择器</div>
<div id="div3">属性选择器</div>
<div id="divd df1">属性选择器</div>
<div id="df1">属性选择器</div>
<div id="divdg df2">属性选择器</div>
<div id="divdg d1f">属性选择器</div>
<div id="divdg d1fg">属性选择器</div>
</body>
</html>点击 "运行实例" 按钮查看在线实例
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号