2016-12-28 29 views
-6

enter image description here如何創建一個具有表單的div?

如何使用css創建這個div?

+0

歡迎您!請參閱:[問] | [mcve] | [幫幫我]。 –

+0

更好的是你應該參考這個[鏈接](http://code-chunk.com/chunks/543df4c394758/bootstrap-arrow-shaped-buttons) –

+0

我認爲這是我在這個網站上見過的最懶的請求。 – 1252748

回答

0

你可以用clip-path: polygon

div { 
 
    background: #666; 
 
    height: 100px; 
 
    width: 200px; 
 
    -webkit-clip-path: polygon(75% 0%, 100% 50%, 75% 100%, 0% 100%, 25% 50%, 0% 0%); 
 
    clip-path: polygon(75% 0%, 100% 50%, 75% 100%, 0% 100%, 25% 50%, 0% 0%); 
 
}
<div></div>

0

做到這一點使用僞元素,你可以這樣來做。

div { 
 
    position: relative; 
 
    background: red; 
 
    width: 150px; 
 
    height: 80px; 
 
} 
 
div:before, 
 
div:after { 
 
    content: ""; 
 
    position: absolute; 
 
    width: 40px; 
 
} 
 
div:before { 
 
    background: red; 
 
    border-top: 40px solid transparent; 
 
    border-bottom: 40px solid transparent; 
 
    border-left: 40px solid white; 
 
} 
 
div:after { 
 
    border-top: 40px solid transparent; 
 
    border-bottom: 40px solid transparent; 
 
    border-left: 40px solid red; 
 
    left: 100%; 
 
}
<div></div>

0

使用僞元素我創建箭頭。請檢查一下。

.arrow { 
 
    border-top: 1px solid #333; 
 
    border-bottom: 1px solid #333; 
 
    padding-top: 5px; 
 
    height: 37px; 
 
    width: 60px; 
 
} 
 
.arrow:after { 
 
    content: ''; 
 
    display: inline-block; 
 
    margin-left: 45px; 
 
    width: 30px; 
 
    height: 30px; 
 
    border-top: 1px solid #333; 
 
    border-right: 1px solid #333; 
 
    -moz-transform: rotate(45deg); 
 
    -webkit-transform: rotate(45deg); 
 
    transform: rotate(45deg); 
 
    position: absolute; 
 
} 
 
.arrow:before { 
 
    content: ''; 
 
    display: inline-block; 
 
    margin-left: -15px; 
 
    width: 30px; 
 
    height: 30px; 
 
    border-top: 1px solid #333; 
 
    border-right: 1px solid #333; 
 
    -moz-transform: rotate(45deg); 
 
    -webkit-transform: rotate(45deg); 
 
    transform: rotate(45deg); 
 
    position: absolute; 
 
}
<div class="arrow"></div>

相關問題