CSS 属性选择器备忘

2019-05-06 17:36:55 浏览数 (2)

再次强烈谴责 W3School,写的根本就是错的,而且怎么发邮件也不改过来。

选择器

效果

[attr]

el.attr !== undefined

[attr=value]

el.attr === 'value'

[attr^=value]

el.attr.startsWith('value')

[attr$=value]

el.attr.endsWith('value')

[attr*=value]

el.attr.includes('value')

[attr~=value]

el.attr.split(' ').includes('value')

[attr|=value]

[attr=value]或[attr^=value-]

0 人点赞