css属性选择器语法:[attribute=value] 如:[target=-blank] /*选择所有使用target=-blank的元素*/或 [attribute~=value] 如:[title~=flower] /*选择标题属性包含单词flower的所有元素*/或[attribute|=language] 如:[lang|=en] /*选择一个lang属性的起始值=en的所有元素*/
css属性选择器实例一:选择所有使用target=_blank的a元素
the link with target=_blank gets a yellow background:
manongjc.comdisney.comwikipedia.orgnote: for [attribute] to work in ie8 and earlier, a doctype must be declared.
在线运行
css属性选择器实例二:选择标题属性包含单词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.
在线运行
css属性选择器实例二:选择一个lang属性的起始值=en的所有元素
hello!
hi!
ello!
hi!
hei!
note: for [attribute|=value] to work in ie8 and earlier, a doctype must be declared.
在线运行
相关阅读:
css选择器