flexslider border-radius does not wrap image in Chrome, Safari, but will in Firefox

ぐ巨炮叔叔 提交于 2019-11-29 15:03:22

问题


I'm trying to have a porthole window look on a flexslider with the slide animation option. Basically the image would slide but be masked in a circle and I'm trying to accomplish this with border-radius and overflow:hidden on the flexslider wrapper.

Check this page out in Firefox to see the desired result, cause its working there. Then see that it doesn't in Chrome or Safari. Here is the link (the slideshow is the picture of me): http://imjoeybrennan.com/about.html

Any help is much appreciated! Thanks, Joey


回答1:


just helped you with an issue. This one is easy too. The reason it is not working in chrome or safari (webkit) is that there is a known bug with webkit when using overflow-hidden + position relative and border radius. The easy fix is to add an svg webkit mask to the same element:

.joey_pic .flexslider {
-webkit-border-radius: 200px;
-moz-border-radius: 200px;
border-radius: 200px;
-webkit-mask-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAA5JREFUeNpiYGBgAAgwAAAEAAGbA+oJAAAAAElFTkSuQmCC);
overflow: hidden;
}

This can also cause jagged edges so another possible solution is to set the border radius on the images within your flexslider: (this is what you are doing on the images below with the hover transition)

.flexslider .slides img {
max-width: 100%;
display: block;
border-radius: 100px;
}

Hope this helps



来源:https://stackoverflow.com/questions/13476942/flexslider-border-radius-does-not-wrap-image-in-chrome-safari-but-will-in-fire

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!