turning a div into transparent to see through two containers

前端 未结 4 1568
野的像风
野的像风 2020-12-19 10:59

I have following markup


   
4条回答
  •  有刺的猬
    2020-12-19 11:37

    What you are asking to do will not work using transparency.

    However, there is a work around that is quite acceptable:

    body {
        background: url(http://placekitten.com/g/400/500);
        background-attachment: fixed;
    }
    .holder {
        width: 500px;
        height: 700px;
        background: rgba(255,255,255,0.8);
        border: 1px dotted blue;
    }
    .circle {
        width: 100px;
        height: 100px;
        border-radius: 50%;
        background: url(http://placekitten.com/g/400/500);
        background-attachment: fixed;
    }
    

    see demo at: http://jsfiddle.net/audetwebdesign/FqMXz/

    Just apply the same background image to the .circle div.

    This trick is taken from one of the CSS books by Eric Meyer.

提交回复
热议问题