I am trying to rounding the sides of a background image with border-radius
property.
Here is my scenario:
I placed a big image in a small division as background and put the overflow hidden. Now I need to round the small division. I successfully rounded the corner of small division. But the image's corner is not rounding.
HTML:
<div class="video_thumb">
<div style="background-image: url(http://img.youtube.com/vi/mAYX42saxkI/0.jpg); " class="video-thumbnail"></div>
</div>
CSS
.video_thumb {
height: 250px;
width: 300px;
overflow:hidden;
margin:20px;
border: 1px solid red;
z-index:100;
position:relative;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
}
.video-thumbnail {
width: 520px;
height: 100%;
position: relative;
background-size: cover;
-moz-background-size: cover;
-webkit-background-size: cover;
background-position: center;
z-index:10;
overflow:hidden;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
}
Here is a demo using jsfiddle
You can see the top left and bottom left border are rounded. But top right and bottom right corner are not rounded. How can we make all the corners of image rounded?
I tried adding z-index
, overflow: hidden
to both divs, but no luck.
EDIT:
This problem is only with Google Chrome. Working fine on Firefox browser.