css3 - css中伪类选择器跟伪对象选择器区别是啥
问题描述
我试过例如:p::first-letter 跟 p:first-letter 设置一段文字一个字的字体;两种方法 效果一模一样啊~!那么伪类选择器跟伪对象选择器区别是啥???
问题解答
回答1:伪类 按现在的规范应当书写成 :weilei伪元素 按现在的规范 应当书写成 ::weiyuansu
但是 以前规范不明确的时候 伪元素 和 伪类 都是写成 :weiyuansu :weilei为了兼容过去的写法所以 你的伪元素 写成一个引号的形式 也是可以被解析的
伪元素主要有:E:first-letter/E::first-letter E:first-line/E::first-line E:before/E::before E:after/E::after E::placeholder E::selection
伪类主要有:E:link E:visited E:hover E:active E:focus E:lang(fr) E:not(s) E:root E:first-child E:last-child E:only-child E:nth-child(n) E:nth-last-child(n) E:first-of-type E:last-of-type E:only-of-type E:nth-of-type(n) E:nth-last-of-type(n) E:empty E:checked E:enabled E:disabled E:target @page:first @page:left @page:right
单冒号 双冒号 主要是为了区别 伪元素还是伪类
两者的区别 引子 大漠 图解css3 p69
伪类一般反映无法在CSS中轻松或者可靠检测到的某个元素的状态或者属性; 伪元素表示DOM外部的某种文档结构
相关文章:
1. redis sentinel怎么跑守护进程以及日志记录位置的?2. python 字符串匹配问题3. javascript - sublime快键键问题4. django - Nginx uwsgi 进程问题5. 前端 - 这段代码一直生效不了,查半天因为 top: 0px; 分号后一个隐藏的东西,也不是占位符...删了就可以生效,这是什么情况。。6. Python异常退出时保存进度?7. 使用git管理webpack的代码时多人怎么协作?一般托管哪些文件?8. html5 - ElementUI table中el-table-column怎么设置百分比显示。9. angular.js - 百度爬虫如何处理“#”符号?10. 百度地图api - Android百度地图SDK,MapView上层按钮可见却不可触,怎么解决?

网公网安备