CSS Opacity not working in IE11

前端 未结 4 1095
别那么骄傲
别那么骄傲 2020-12-17 16:31

I\'m trying to make the background-color of a tr opaque with this CSS:

.faded{
    background-color: red;
    height: 100px;
    op         


        
相关标签:
4条回答
  • 2020-12-17 16:49

    add this line to the head of your html, and the opacity will work fine

    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    
    0 讨论(0)
  • 2020-12-17 17:10

    Try adding <!DOCTYPE html> declaration. See this answer

    0 讨论(0)
  • 2020-12-17 17:12

    If someone else has a problem, it helped me:

    .foo {
      opacity: 0.4;
      position: relative; /* for IE */
    }
    

    More info

    0 讨论(0)
  • 2020-12-17 17:14

    That appears to be yet another IE bug.. As a work-around, you could instead add the opacity via the background property with a rgba() color. Then simply add the opacity to the td element.

    Updated Example - results seem consistent across browsers.

    .faded {
        background-color: rgba(255, 0, 0, 0.4);
        height: 100px;
    }
    td {
        opacity:0.4
    }
    
    0 讨论(0)
提交回复
热议问题