css选择器,即css里定义的样式如何指定的位置,通常有三种选择器,即:html标签选择器、class标签选择器、id选择器
html标签选择器的用法,先看例子:
<html>
<head>
<style type="text/css">
p {
color:blue
}
</style>
</head>
<body>
<p>
在style里直接输入p再接大括号来直接对指定的标签设置样式
</p>
</body>
</html>
class选择器,看示例
<html>
<head>
<style type="text/css">
.p {
color:blue
}
</style>
</head>
<body>
<p class="p">
class选择器用.类名进行选取
</p>
</body>
</html>
id选择器,看示例
<html>
<head>
<style type="text/css">
#p {
color:blue
}
</style>
</head>
<body>
<p id="p">
id选择用#开头进行选取。
</p>
</body>
</html>
三种选择器优先顺序是,id>class>html
后面覆盖前面。