:target pseudo-class not working properly in firefox

前端 未结 1 362
轮回少年
轮回少年 2021-01-26 05:59

I am making a page with a CSS lightbox-type effect using the :target pseudo-class. When you click on an image, a box pops up with info in it, and goes away again when you click

1条回答
  •  走了就别回头了
    2021-01-26 06:59

    The pseudo-class target works on id elements, not classes: https://developer.mozilla.org/en-US/docs/Web/CSS/:target

    The :target pseudo-class represents the unique element, if any, with an id matching the fragment identifier of the URI of the document.

    Try replacing your .lightbox with #lightbox in your CSS, and your HTML element should be

    0 讨论(0)
提交回复
热议问题