时间:2021-07-01 10:21:17 帮助过:23人阅读
[attribute=value] 如:[target=-blank] /*选择所有使用target="-blank"的元素*/
或
[attribute~=value] 如:[title~=flower] /*选择标题属性包含单词"flower"的所有元素*/
或
[attribute|=language] 如:[lang|=en] /*选择一个lang属性的起始值="EN"的所有元素*/
选择所有使用target="_blank"的a元素
The link with target="_blank" gets a yellow background:
manongjc.com
disney.com
wikipedia.org
Note: For [attribute] to work in IE8 and earlier, a DOCTYPE must be declared.
在线运行
选择标题属性包含单词"flower"的所有元素
The image with the title attribute containing the word "flower" gets a yellow border.
Note: For [attribute~=value] to work in IE8 and earlier, a DOCTYPE must be declared.
在线运行
选择一个lang属性的起始值="en"的所有元素
Hello!
Hi!
Ello!
Hi!
Hei!
Note: For [attribute|=value] to work in IE8 and earlier, a DOCTYPE must be declared.
在线运行
相关阅读:
css选择器