How to Fix Border-Radius and Background Gradient Bleeding in IE9?

Linda Hamilton
Release: 2024-10-28 15:41:02
Original
820 people have browsed it

How to Fix Border-Radius and Background Gradient Bleeding in IE9?

Fixing Border-Radius and Background Gradient Bleeding in IE9

In Internet Explorer 9, rounded corners and background gradients can be implemented separately using CSS3 border-radius. However, combining these elements often results in gradient bleeding beyond the rounded corners.

To resolve this issue, one workaround involves wrapping the gradient element within a containing div that matches its dimensions and rounded corner values. This essentially creates a mask that confines the gradient within the desired area.

HTML:

<div class="mask roundedCorners">
    <div class="roundedCorners gradient">
        Content
    </div>
</div>
Copy after login

CSS:

.mask {
    overflow: hidden;
}

.roundedCorners {
    border-radius: 5px;
    -moz-border-radius: 5px;
    -webkit-border-radius: 5px;
}

.gradient {
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#0065a4', endColorstr='#a0cf67',GradientType=0 ); /* IE6-9 */
}
Copy after login

This approach effectively masks the gradient bleed by clipping it at the boundaries of the rounded corners. However, it's important to note that it may impact interactivity with the underlying gradient content.

The above is the detailed content of How to Fix Border-Radius and Background Gradient Bleeding in IE9?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
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!