交作业<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>CSS选择器</title>
<style type="text/css">
* {/*通配符选择器用星号'*'该选择器可以与任何元素匹配,就像是一个通配符 */
color:red;
}
html,body{ /*选择器分组用逗号','可以将任意多个选择器分组在一起*/
font-family: sans-serif, serif,cursive,fantasy,monospace;
}
.body{ /*类选择器用'.'*/
background-color: beige;
margin: 0;
padding: 0;
position: relative;
}
.slogan.en{ /*多类选择器 通过把两个(或两个以上)类选择器链接在一起,仅可以选择同时包含这些类名的元素(类名的顺序不限)*/
font-size: 16px;
color: blue;
}
h1{/*标签选择器 匹配文档树中该元素类型的每一个实例*/
height: 100%;
color: red;
}
#container{ /*Id选择器用'#' 只能在文档中使用一次,而且仅一次;ID 选择器不能结合使用,因为 ID 属性不允许有以空格分隔的词列表*/
width: 100%;
text-align: center;
}
a{
color: green;
}
/*属性选择器[]
[attribute] 用于选取带有指定属性的元素。
[attribute=value] 用于选取带有指定属性和值的元素。
[attribute~=value] 用于选取属性值中包含指定词汇的元素。
[attribute|=value] 用于选取带有以指定值开头的属性值的元素,该值必须是整个单词。
[attribute^=value] 匹配属性值以指定值开头的每个元素。
[attribute$=value] 匹配属性值以指定值结尾的每个元素。
[attribute*=value] 匹配属性值中包含指定值的每个元素。
后代选择器 h1 em {color:red;}
子元素选择器 h1 > strong {color:red;}
相邻兄弟选择器 h1 + p {margin-top:50px;}
*/
</style>
</head>
<body class="body">
<div id="container">
<h1>我爱鱼C</h1>
<p class="p slogan">让编程改变世界!</p>
<p class="p slogan en">Change the world by program!</p>
<a href="http://www.fishc.com/" id="first_Js">传送门</a>
<a href="http://bbs.fishc.com/forum.php?mod=collection&action=view&ctid=539" id="first_Js2">HTML5-庖丁解牛</a>
</div>
</body>
</html>
|