您的位置:首页 > 技术中心 > 前端框架 >

css结构化伪类选择器有哪些

时间:2022-02-11 16:46

选择器有::root、:not、:only-child、:first-child、:last-child、:empty:target、:nth-child(n)、nth-last-child(n)、:nth-of-type(n)等。

本教程操作环境:windows7系统、CSS3&&HTML5版、Dell G3电脑。

:root选择器 :匹配文档根元素

在这里插入图片描述

:not 选择器:首先得向该结构元素需要排除的子结构元素设置样式才有效果在这里插入图片描述

Example:

在这里插入图片描述

:only-child:

在这里插入图片描述

first-child、:last-child:

在这里插入图片描述

:nth-child(n)、nth-last-child(n):

在这里插入图片描述

:nth-of-type(n)、nth-last-of-type(n):

在这里插入图片描述

:nth-child(n)与:nth-of-type(n)的区别

在这里插入图片描述

7、:empty::empty选择器用来选择没有子元素或文本内容为空的所有元素。

8、:target::target选择器用于为页面中的某个target元素(该元素的id被当做页面中的超链接来使用)指定样式。只有用户单击了页面中的超链接,并且跳转到target元素后,:target选择器所设置的样式才会起作用。

推荐学习:css视频教程

以上就是css结构化伪类选择器有哪些的详细内容,更多请关注gxlsystem.com其它相关文章!

本类排行

今日推荐

热门手游