2014-03-07 96 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

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

相關問題