图像可以有伪元素吗?
在我的测试中,我无法对图像元素使用 :before 或 :after,但我希望获得更多信息。
编辑:不幸的是,W3C 也不清楚:
Note. This specification does not fully define the interaction of :before and :after with replaced elements (such as IMG in HTML). This will be defined in more detail in a future specification.
最佳答案
这真的没有任何意义。 :before 和 :after 在匹配的元素内部插入额外的内容,而 img 没有内部。
关于html - 伪元素和图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7522942/