元素选择器分类
- 通配选择器
- 类型选择器
- ID选择器
- 类选择器
通配选择器
通常以通配符*类进行配置样式
* {
margin: 0;
padding: 0;
}
类型选择器
类型选择器是以标签名称类来编写样式
p{
background-color: red;
border: solid 1px black;
margin: 0 0 5px 0;
height: 50px;
}
ID选择器
ID选择器是以标签中id属性名称来编写样式,#链接标签id属性方式
#top {
background-color: red;
border: solid 1px black;
margin: 0 0 5px 0;
height: 50px;
}
类选择器
类型选择器是以标签中class属性名称类来编写样式,.链接标签id属性方式
.top {
background-color: red;
border: solid 1px black;
margin: 0 0 5px 0;
height: 50px;
}