2014-03-07 63 views
-6

我想切出一个三角形(或任何形状)出一个区域,以具有透明区域。 我正在尝试创建一个效果,例如here,其中箭头状的三角形显示为从对象中切出。从区域切出一个区域

非常感谢您提前!

+0

网站不给你想要什么一个很好的迹象。更清楚。也许添加一些你想要的截图 –

+1

你试图复制的效果是使用[中间有透明“剪切”的图像)(http://www.dsorig.com/images/border.png) – kei

+0

该网站使用此图片:http://www.dsorig.com/images/arrow-down.png –

回答

0

我正在添加一个jsfiddle链接,它可以帮助您解答问题。

CSS

body { background: yellow; } 

.bar { 
    position: relative; 
    width: 90%; 
    height: 30px; 
    margin: 0 auto; 

} 

.bar > a { 
    position: absolute; 
    top: 0px; 
    left: 60%; 
    width: 20%; 
    text-align: center; 
    font-size: 30px; 
    color: yellow; 
    padding-top: 30px; 
} 

.bar > a:before, .bar > a:after { 
    content:''; 
    position: absolute; 
    z-index: -1; 
    top: 0; 
    width: 0; 
    height: 30px; 
    border-top: 30px solid transparent; 
} 

.bar > a:before { 
    border-left: 20px solid red; 
    left: 50%; 
} 
.bar > a:after { 
    border-right: 20px solid blue; 
    right: 50%; 
} 

.bar:before, .bar:after { 
    content:''; 
    position: absolute; 
    top: 0; 
    height: 0; 
    border-top: 30px solid white; 
    -webkit-box-sizing: border-box; 
    -moz-box-sizing: border-box; 
     -ms-box-sizing: border-box; 
      box-sizing: border-box; 
} 

.bar:before { 
    left: 0; 
    width: 70%; 
    border-right: 30px solid transparent; 
} 

.bar:after { 
    right:0; 
    width: 30%; 
    border-left: 30px solid transparent; 
} 

http://jsfiddle.net/JaMH9/219

+0

如果它可以帮助你接受。 –