Full Page Blur in CSS

前端 未结 8 940
清酒与你
清酒与你 2020-12-08 09:59

How can I blur a whole page using CSS? Other elements such as images are allowed.

8条回答
  •  感动是毒
    2020-12-08 10:46

    I am not sure if this is what you mean, but an often seen blur-like effect is created by creating a full height, full width DIV-element with a background-color and opacity property set.

    /* DIV-element with black background and 50% opacity set */
    div.overlay {
        position: absolute;
        width: 100%;
        top: 0;
        left: 0;
        background: #000;
        opacity: 0.5;
        filter: alpha(opacity = 50); /* required for opacity to work in IE */
    }
    

    Since your page height can vary, you'd probably want to use Javascript to set the height for this element.

提交回复
热议问题