2014-07-21 328 views

回答

0

您给出的示例使用具有透明背景的图像。

这是可能的CSS。

JSFiddle

HTML:

<div></div> 

CSS:

div { 
    height:200px; 
    width:1000px; 
    background:indianred; 
    margin-top:250px; 
    position:relative; 
} 

div::before { 
    content:''; 
    position:absolute; 
    width: 0; 
    height: 0; 
    border-bottom: 100px solid indianred; 
    border-left: 1000px solid transparent; 
    top:-100px; 
} 

div::after { 
    content:''; 
    position:absolute; 
    width: 0; 
    height: 0; 
    border-top: 100px solid indianred; 
    border-right: 1000px solid transparent; 
    bottom:-100px; 
} 

如果你想浏览器的兼容性,你必须坚持与图像的方法。

+0

我在osx上最新的chrome上,图片中没有斜角。 – Donato

+0

因此,我最后的评论,“如果你想浏览器的兼容性,你必须坚持使用图像方法。它不适用于所有浏览器。对不起。 @DanStayntouch – Albzi

0

你可以使用一个后台招:

<div class="div1"> 
    content 1 
</div> 
<div> content 2</div> 


.div1 { 
    background: linear-gradient(352deg, transparent 125px, #c00 0) bottom right;} 

检查此琴:http://jsfiddle.net/2f7Ds/

+0

改编自这个问题:http://stackoverflow.com/questions/10349867/how-do-i-bevel-the-corners-of-an-element – Luciano