CSS blur on background image but not on content

前端 未结 5 2122
予麋鹿
予麋鹿 2020-11-27 06:21

I did this example.

I\'m trying to blur the background image, but the main content is blurred too (the )

How can I blur the backgrou

5条回答
  •  天涯浪人
    2020-11-27 07:03

    backdrop-filter

    Unfortunately Mozilla has really dropped the ball and taken it's time with the feature. I'm personally hoping it makes it in to the next Firefox ESR as that is what the next major version of Waterfox will use.

    MDN (Mozilla Developer Network) article: https://developer.mozilla.org/en-US/docs/Web/CSS/backdrop-filter

    Mozilla implementation: https://bugzilla.mozilla.org/show_bug.cgi?id=1178765

    From the MDN documentation page:

    /* URL to SVG filter */
    backdrop-filter: url(commonfilters.svg#filter);
    
    /*  values */
    backdrop-filter: blur(2px);
    backdrop-filter: brightness(60%);
    backdrop-filter: contrast(40%);
    backdrop-filter: drop-shadow(4px 4px 10px blue);
    backdrop-filter: grayscale(30%);
    backdrop-filter: hue-rotate(120deg);
    backdrop-filter: invert(70%);
    backdrop-filter: opacity(20%);
    backdrop-filter: sepia(90%);
    backdrop-filter: saturate(80%);
    
    /* Multiple filters */
    backdrop-filter: url(filters.svg#filter) blur(4px) saturate(150%);
    

提交回复
热议问题