Home >Web Front-end >CSS Tutorial >Why is Border Radius Not Working on Images in Chrome?

Why is Border Radius Not Working on Images in Chrome?

Barbara Streisand
Barbara StreisandOriginal
2024-10-23 23:29:30296browse

Why is Border Radius Not Working on Images in Chrome?

CSS Border Radius Not Applied to Images in Webkit

Having trouble applying border-radius to the #screen element using Chrome but not other browsers? This issue is likely due to a flaw in Chrome's handling of image trimming.

The #screen element uses CSS to set a background image rounded with border-radius:

#screen {
    -moz-border-radius: 10px;
    -webkit-border-radius: 10px;
    -o-border-radius: 10px;
    border-radius: 10px;
}

However, in Chrome, the image appears to be unaffected by the border-radius property.

Workaround

To address this bug, a workaround is available:

.element-that-holds-pictures {
    perspective: 1px;
}

Applying perspective to the parent element containing the images forces Chrome to correctly apply border-radius without distorting the image quality. This workaround does not affect the display, unlike other alternatives such as opacity:0.99.

The above is the detailed content of Why is Border Radius Not Working on Images in Chrome?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn