css样式选择器的类型---lesson2
2017-06-07 00:31
429 查看
css样式选择器有4类:
1、类选择器,可以作用任何html元素2、id选择器,仅用于一个html元素
3、标签选择器,用于相同的html标签元素
4、复合内容选择器,基于选择的内容
基本使用范例:
截图:
代码:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Insert title here</title> <style type="text/css"> .zs-item { font-size: 18px; color: #F60; } #zs-first { font-size: 24px; color: #309; } a { font-size: 14px; color: #99F; } a:link { color: #f00; } a:visited { color: #0f0; } a:hover { color: #00f; } a:active { color: #FCF; } h1,h2,h3{ color:#309; } #item-btn button { font-size: 18px; font-weight: bold; text-transform: none; font-family: "Arial Black", Gadget, sans-serif; font-style: normal; line-height: normal; background-color: #0CC; width: auto; float: left; clear: none; padding: 20px; list-style-type: none; } </style> </head> <body> <p class="zs-item">今天天气不错! </p> <p id="zs-first">天很蓝</p> <em><strong><a href="http://www.baidu.com">去外面看看把 </a> </strong></em> <h1>我是h1</h1> <h2>我是h2</h2> <h3>我是h3</h3> <div id="item-btn"> <button>真无聊</button> </div> <button>真无聊2</button> </body> </html>
更加详细的可以参考下面图片设置规则:
相关文章推荐
- FLEX CSS样式:类选择器和类型选择器的区别
- css样式选择器
- jQuery中有哪几类型选择器
- Class类型, 选择器Selector以及指针函数
- [导入]泛型技巧系列:简单类型选择器
- id类型、动态判断与选择器
- java基础57 css样式、选择器和css定位(网页知识)
- [Objective-C]SEL类型、@selector选择器
- CSS样式----图文详解:css样式表和选择器
- css样式的使用(二)-选择器(下)
- Swing 实现文件选择器的显示,及图片(blob类型)在数据库的输入,输出问题
- Andorid下的状态选择器(带shape类型)
- objective-C中的Class(类类型),Selector(选择器SEL),函数指针(IMP)
- objective-C中的Class(类类型),Selector(选择器SEL),函数指针(IMP)
- CSS样式选择器及优先级
- HTML+CSS总结(2)选择器的类型
- ASP.NET MVC5 学习笔记-1 控制器、路由、返回类型、选择器、过滤器
- JS判断浏览器类型和屏幕分辨率来调用不同的CSS样式
- ObjC(Objective-C)中的Class(类类型),Selector(选择器SEL),函数指针(IMP)
- HTML5表单之Input 类型- Date Pickers(日期选择器)