html - Hide blur overflow from element -


if have simple image this:

<img src="image.jpg" class="blur">  .blur {     filter:blur(20px);     -o-filter:blur(20px);     -ms-filter:blur(20px);     -moz-filter:blur(20px);     -webkit-filter:blur(20px); } 

when blurred, image edges overflow, , blur.

blur

what trying do, blur image, without overflow. have tried wrapping in <div>, , setting overflow hidden:

<div class="image">     <img src="image.png" class="blur"> </div>  .image {     width: auto;     height: auto;     overflow: hidden;     display: inline-block; } 

however, not have effect. please explain how this?

fiddle: http://jsfiddle.net/629yl/

if want put image this, won't work. need wrap around in div , put background of div inside wrapper div. hide overflow of parent - work.

however, distortion still there , image take considerably more space.

html

<div class="box"> <div class="blur"></div> </div> 

css

    .box {     overflow: hidden;     margin:5px; }  .blur {     -webkit-filter: blur(20px);     margin: -5px 0 0 -5px;     background: url("http://readwrite.com/files/dogecoin.jpg");     height:400px;     width:400px; } 

demo


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -