2014-04-28 11 views
0

当你有一个带有边界半径的可滚动div时,孩子们会使用eclipse或者不尊重这个边界半径。例如下面是该问题的一个小提琴:滚动元素上的border-radius

http://jsfiddle.net/Thatguyhampton/E9dmr/2/

.scrollable { 
    overflow: auto; 
    overflow-y: overlay; 
    -webkit-overflow-scrolling: touch; 
    -webkit-transform: translate3d(0, 0, 0); 
    height: 400px; 
    width: 200px; 
    background-color: blue; 
    border-radius : .5em; 
} 

.content { 
    height: 500px; 
    width: 200px; 
} 

.content-top { 
    position :absolute; 
    top: 0; 
    height: 50px; 
    width : 200px; 
    background-color: red; 
} 

红色区域显示尖角,而不是圆形的人父。有没有办法解决?

+0

的[相同的边框半径(http://jsfiddle.net/E9dmr/5/)添加到子(或[继承边界半径(http://jsfiddle.net/E9dmr/ 4 /))是不是我想的解决方案? – potashin

回答

0

DEMO JS FIDDLE

.content-top { 
    /*position :absolute;*/ 
    top: 0; 
    height: 50px; 
    width : 200px; 
    background-color: red; 
} 

注出 '的位置是:绝对' 的。内容顶元件上解决该问题。

+0

谢谢你这个伎俩! – thatguyhampton

0

Fixed DEMO Example

红色元素没有边界半径和走在盘旋半径滚动元素(蓝色)。边界半径不会裁剪! (仅边框半径)

解决问题: 您可以将红色元素的border-radius添加到左上角。

.content-top { 
    border-top-left-radius : .5em; 
} 
0

改变这一行这样DEMO

.content-top { 
    position :absolute; 
    top: 0; 
    height: 50px; 
    width : 200px; 
    background-color: red; 
    -webkit-border-top-left-radius: 3px; 
-webkit-border-top-right-radius: 3px; 
-moz-border-radius-topleft: 3px; 
-moz-border-radius-topright: 3px; 
border-top-left-radius: 3px; 
border-top-right-radius: 3px; 
} 
0
.scrollable { 
    overflow: auto; 
    overflow-y: overlay; 
    -webkit-overflow-scrolling: touch; 
    -webkit-transform: translate3d(0, 0, 0); 
    height: 400px; 
    width: 200px; 
    background-color: blue; 
    border-radius : .5em; 
} 

.content { 
    height: 400px; 
    width: 200px; 
} 

.content-top { 
    /*position :absolute;*/ 
    top: 0; 
    height: 50px; 
    width : 200px; 
    background-color: red; 
}