Web全栈-选择器练习
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>选择器练习</title>
<style>
/*标签选择器
p{
color: red;
}
*/
/*id选择器
#identity1{
color: red;
}
#identity2{
color: red;
}
*/
/*类选择器
.para{
color: red;
}
*/
/*后代选择器
div p{
color: red;
}
*/
/*子元素选择器
div>p{
color: red;
}
*/
/*交集选择器
p.para{
color: red;
}
*/
/*并集选择器
#identity1,#identity2{
color: red;
}
*/
/*通用兄弟选择器
h1~p{
color: red;
}
*/
/*序选择器
p:nth-of-type(n+1){
color: red;
}
*/
/*属性选择器*/
p[id]{
color: red;
font-size: 10px;
text-decoration: underline;
}
</style>
</head>
<body>
<div>
<h1>我是标题</h1>
<p id="identity1" class="para">我是段落1</p>
<p id="identity2" class="para">我是段落2</p>
</div>
</body>
</html>
本文版权归作者和博客园共有,欢迎转载,但必须给出原文链接,并保留此段声明,否则保留追究法律责任的权利。
author:yindanny
email: yindanny@qq.com
github: https://github.com/yindanny
githubblog: https://yindanny.github.io