Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

border-radius creates an outline in IE

When border-radius is applied to a coloured div that has a white border, the background color appears outside the white border in corners. Why is this happening in ie? (Tried ie9 and ie10).

<div class="rounded"></div>

.rounded {
    display: inline-block;
    -webkit-border-radius: 50%;
    -moz-border-radius: 50%;
    -ms-border-radius: 50%;
    border-radius: 50%;
    border: 3px solid #fff;
    background: #f00;
    width: 100px;
    height: 100px;
}

body {
    background-color: #fff;
}

The thing here is that I really need the white border, so removing it or making it transparent, as some have proposed, is not an option. Here is a fiddle: http://jsfiddle.net/z0rt63e2/1/

like image 561
tofu Avatar asked Jan 09 '23 14:01

tofu


1 Answers

As in my comment above (in the interest of having an answer), use background-clip: content-box in your .rounded class.

Here's some reading material: http://www.css3.info/preview/background-origin-and-background-clip/

like image 90
disinfor Avatar answered Jan 22 '23 12:01

disinfor