How to Prevent Background Gradient Bleeding in Rounded Corners in IE9?

Mary-Kate Olsen
Release: 2024-10-27 03:03:03
Original
510 people have browsed it

 How to Prevent Background Gradient Bleeding in Rounded Corners in IE9?

IE9 borderRadius and Background Gradient Bleeding: A Solution Unveiled

In the world of web development, IE9's support for border-radius has been a welcome addition. Yet, when combined with background gradients, an unexpected issue arises: gradient bleeding outside the rounded corners.

To address this problem, a clever solution emerges: creating a parent div that masks the inner content. This mask div, with the same size, rounded corners, and hidden overflow, acts as a barrier, preventing the gradient from spilling over the edges.

By utilizing the following HTML and CSS, you can implement this workaround:

<code class="html"><div class="mask roundedCorners">
    <div class="roundedCorners gradient">
        Content
    </div>
</div></code>
Copy after login
<code class="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 */
}</code>
Copy after login

This workaround effectively addresses the bleeding issue, providing a streamlined user experience without diminishing the visual appeal of rounded corners and background gradients.

The above is the detailed content of How to Prevent Background Gradient Bleeding in Rounded Corners 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!