html - 为什么 CSS3 边框半径不适用于 webkit 浏览器(Chrome 和 Safari)上的图像?

标签 html css cross-browser

这适用于 firefox 4 和 ie9,但不适用于 chrome 或 safari。它在歌剧中也不起作用,但谁在乎呢。那么如何让它发挥作用呢?

img { width: 100px; height: 100px; border: 3px solid #fff; 

-moz-border-radius: 10px; 
-webkit-border-radius: 10px; 
border-radius: 10px; 

}

最佳答案

解决方法是使用 div 并将 div 的背景设置为图像。

.rounded { 
    width: 100px;
    height: 100px; 
    border: 3px solid #fff; 

    -moz-border-radius: 10px; 
    -webkit-border-radius: 10px; 
    border-radius: 10px; 

    background: url(image.png) no-repeat;
}

关于html - 为什么 CSS3 边框半径不适用于 webkit 浏览器(Chrome 和 Safari)上的图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6195472/

相关文章:

html - 具有自动滚动功能的固定长度的动态列

css - 如何将 alpha 值添加到 css 中的变量?

CSS 布局和 IE 6

html - :after in Internet Explorer isn't working

html - 非英语人士的编程资源

javascript - 如果在 iframe 中,则以不同方式显示页面 (css)

javascript - 附加到动态内容

html - Angular:如何通过 HTML 而不是 CSS 传递背景图片 URL?

javascript - 如何避免 Internet Explorer 的第一个按钮选择?

javascript - 脚本延迟不起作用