Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
谁能告诉我如何根据标签的-attribute 值将一些 CSS 应用于<img>标签?alt
<img>
alt
例如,我有 ALT 值为 DISAPPEAR 的图像
悬停时,我想设置
img[DISAPPEAR]:hover { display:none; }
上面的代码似乎不起作用:(
干得好:
img[alt="DISAPPEAR"]:hover { display:none; }
它是这样工作的: selector[attribute="value"]
selector[attribute="value"]
正如 CoderOfHonor 所说,你应该使用
但是要在 IE 8 或更早版本中工作,您应该有<!DOCTYPE>!
<!DOCTYPE>