css选择器,了解一下

高宽比

aspect-ratio 检测浏览器的高宽比
decice-aspect-ratio检测设备的高宽比

像素比

device-pixel-ratio

dom选择器

  1. 类选择器 class selectors
.classname
  1. 类型选择器 type selectors
  2. 属性选择器 attribute selectors
  3. 标签选择器
  4. id选择器
#idname
  1. 通配符选择器 *
  2. 子元素选择器 >
  3. 后代选择器 加一个空格
  4. 相邻元素选择器 +
  5. 组选择器 多个元素之间使用 ,

伪选择器

pseudo-selectors
用于文档树之外的元素或信息

结构化伪类
:nth-child(n)

li:nth-child(2){
    color:red;  
} //取父元素中的内的第二个li元素

:nth-last-child(n)
从最后一个开始计算

:nth-of-type(n)
查询第n个元素

:root
根元素 html标签

:target
目标伪类

:enabled
:disabled
状态伪类

:checked

属性选择器

Attribute Selectors

扫描二维码关注公众号,回复: 1554565 查看本文章
<p ref = 'test' ></p>
p[ref~ = 'test ] {color:red;}

猜你喜欢

转载自blog.csdn.net/java_sparrow/article/details/80549414