欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  web前端

CSS笔记之伪类与伪元素_html/css_WEB-ITnose

程序员文章站 2022-03-16 18:45:47
...
伪类分为两种:UI伪类 与 结构化伪类

UI伪类:a:link{} a:hover{} a:active{} a:visited{}

input[type='text']:focus{} #title-one:target{}

结构化伪类: table tr:nth-child(even){} //even---下标为偶数的子元素

table tr:nth-child(odd){} //odd---下标为奇数的子元素

table tr:first-child{}

table tr:last-child{}

ul li:first-child{}

伪元素:最常用的伪元素莫过于 :before 与 :after

在清除浮动时就使用这两个伪元素,当然,在其他的地方也会用到。

关于伪类与伪元素的笔记就到此,如果园友知道更多的,欢迎补充。