Is it possible to use -webkit-filter: blur(); on background-image?

前端 未结 3 1146
太阳男子
太阳男子 2020-12-04 14:52

Is it possible to use -webkit-filter: blur(); on background-image?

I have tried this code and it just blurs everything but the background-image:

3条回答
  •  执念已碎
    2020-12-04 15:20

    If background for the full page then this is the best solution for me.

    body {
        //background-color: black;  use it if you don't want the background border
    }
    body:before {
        content: '';
        position: fixed;
        width: 100vw;
        height: 100vh;
        background-image: url('http://www.publicdomainpictures.net/pictures/10000/velka/pebbles-and-sea-11284647414Rbeh.jpg'); // your image
        background-position: center center;
        background-repeat: no-repeat;
        background-position: 100% 100%;
        background-size: cover;
        filter: blur(2px);
        z-index: -9;
    }
    

提交回复
热议问题