background-image + rgba() with fallback in IE 7-8

前端 未结 2 1823
谎友^
谎友^ 2021-01-05 23:27

I\'ve got an element that has background image and transparent background color. I want IE to fall back to solid color.

.element {
    background: url(image.         


        
相关标签:
2条回答
  • 2021-01-05 23:36

    To write CSS rules specificially to IE8 or below, add a backslash and 9 (\9) at the end before the semicolon.

    example: background-color:#000\9;

    source

    0 讨论(0)
  • 2021-01-05 23:45

    Try this:

    .element {
        background: url(image.png);
        background-color: #000; /* IE 8 */
        background-color: rgba(0,0,0,0.5);
        *background-color: #000; /* IE 7 */
    }
    
    0 讨论(0)
提交回复
热议问题