永发信息网

伪类选择器和伪元素选择器的区别

答案:2  悬赏:40  手机版
解决时间 2021-02-05 22:03
  • 提问者网友:锁深秋
  • 2021-02-05 14:50
伪类选择器和伪元素选择器的区别
最佳答案
  • 五星知识达人网友:不想翻身的咸鱼
  • 2021-02-05 16:24
伪元素和伪类之所以这么容易混淆,是因为他们的效果类似而且写法相仿,但实际上 css3 为了区分两者,已经明确规定了伪类用一个冒号来表示,而伪元素则用两个冒号来表示。
全部回答
  • 1楼网友:詩光轨車
  • 2021-02-05 17:41
伪类 按现在的规范应当书写成 :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 单冒号 双冒号 主要是为了区别 伪元素还是伪类
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯