33岁从0开始学习CSS_runoob.com_4

P
id/class选择器
id # 单个控件
class . 多个控件

D
<!DOCTYPE html>
<html>
<head>
<style>
#helloId {
color:red;
text-align:center;
}
p.helloClass {
color:blue;
text-align:center;
}
</style>
</head>
<body>
<p id="helloId">hello selector css id<p>
<p class="helloClass">hello selector css class</p>
</body>
</html>

C
1/尝试了id和class选择器
2/同时使用p元素,id和class均对p样式进行了自定义,发现id比class优先级别要高

A
继续学习

猜你喜欢

转载自jyokeisen.iteye.com/blog/2295058