IE 11 Bug - Image inside label inside form

前端 未结 7 1712
面向向阳花
面向向阳花 2021-02-18 13:13

In IE11, the following piece of code will check the radio button as expected:



7条回答
  •  日久生厌
    2021-02-18 14:01

    Here is a solution that worked for me using pointer-events:none without having to set my image to position:relative as I needed it to be position:absolute for my design.

    HTML

    `
    `

    CSS

    So in this example we have an image that needs to be position: absolute

    img {
        position: absolute
        top: 10px;
        right: 10px;
        height: 25px;
        width: 25px;
        display: inline-block; /* can be block, doesn't matter */
    }
    

    Now set pointer-eventson the img-wrapper div

    .img-wrapper {
        position: relative /* this is required for this to work */
        pointer-events: none /* this is what will make your image clickable */
    }
    

提交回复
热议问题