我想爲我的網站做一個橫幅,有點不同。css剪輯路徑替代
我想下邊框,是一種 「向下箭頭」 尋找
事情是這樣的:JS FIDDLE
.indexBanner {
background-image: url('https://i.stack.imgur.com/dFUnt.jpg');
background-repeat: no-repeat;
background-attachment: fixed;
background-position: center;
background-size: cover;
background-color: #404040;
height: 500px;
position: relative;
-webkit-clip-path: polygon(50% 0%, 100% 0, 100% 85%, 50% 100%, 0 85%, 0 0);
}
<div class="indexBanner"></div>
但目前我使用的夾路徑,這不支持Firefox和IE。 而且你可以看到「箭頭形」的邊框有點混亂。
我也試過transform: skew
在這種情況下,結果更多的是「聊天泡泡」效果。
有沒有辦法做到這一點,因爲我都沒有想法。
您可以使用本答案中提到的'skew'方法 - http://stackoverflow.com/questions/30368404/how-to-create-a-polygon-shape-div/30370429#30370429。我不明白你的意思是「聊天泡泡」效應。也許如果你演示一個演示,我可以幫助微調它。 SVG將是你最好的選擇。 – Harry
檢查[this](https://jsfiddle.net/alireza_safian/qkvz8z1j/10/) – Alex
只是注意到,Firefox已經支持'clip-path'參考SVG''元素的年齡和基本形狀像大約一年的「多邊形」(沒有前綴)。它需要''about:config'中的'layout.css.clip-path-shapes.enabled'標誌設置爲'true'。 –
Ana