Does :before not work on img elements?

后端 未结 12 2449
眼角桃花
眼角桃花 2020-11-22 01:46

I\'m trying to use the :before selector to place an image over another image, but I\'m finding that it simply doesn\'t work to place an image before an im

12条回答
  •  南旧
    南旧 (楼主)
    2020-11-22 02:14

    The pseudo-elements generated by ::before and ::after are contained by the element's formatting box, and thus don't apply to replaced elements such as img, or to br elements.

    https://developer.mozilla.org/en-US/docs/Web/CSS/::after

提交回复
热议问题