css基础选择器
标签选择器(元素选择器)
- 标签选择器是指html标签名作为选择器,按标签名分类
标签名 {属性:属性值;**} or 元素名{属性:属性值;**}
- 标签选择器的最大优点就是能快速为页面中同类型的的标签统一样式,不能涉及差异化
类选择器
- 类选择器使用"."来进行标识,后面紧跟类名
.类名 {属性: 属性值}
- 标签调用的时候用
class="类名"
即可
- 类选择最大的优势是可以为元素对象定义单独或相同的样式
1.长名称或词组可以使用中横线来为选择器命令 2.不建议使用下划线来命名css选择器 3.不要纯数字、中文等命名,尽量使用英文来命名
ID选择器
- 类选择器使用"#"来进行标识,后面紧跟id
#类名 {属性: 属性值}
- 标签调用的时候用
id="id"
即可