Why is Border Radius Not Working on Images in Chrome?

Barbara Streisand
Release: 2024-10-23 23:29:30
Original
214 people have browsed it

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;
}
Copy after login

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;
}
Copy after login

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!

source:php
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!