0
我正在嘗試重新設計網站主頁。 如何將當前正在使用的全屏幕背景圖片分割成3個部分,每個部分與圖片只在菱形形狀中顯示之間存在差距?Triple'菱形'圖像拆分CSS
我環顧四周,找到了CSS + HTML來創建與圖像裏面的菱形,但它是整個圖像,只有這些菱形形狀之一。
.polygon-each {
padding: 10px;
text-align: center;
}
.polygon-each-img-wrap img {
margin-bottom: 10px;
}
.polygon-each img {
display: block;
margin-left: auto;
margin-right: auto;
}
}
img {
max-width: 100%;
height: auto;
}
.polygon-clip-rhomboid {
-webkit-clip-path: polygon(0% 100%, 30% 0%, 100% 0%, 70% 100%);
clip-path: polygon(0% 100%, 30% 0%, 100% 0%, 70% 100%);
-webkit-clip-path: url("#polygon-clip-rhomboid");
clip-path: url("#polygon-clip-rhomboid");
}
<div class="polygon-each">
<div class="polygon-each-img-wrap">
<img src="/img/rules-bgrnd.png" alt="demo-clip-rhomboid" class="polygon-clip-rhomboid">
</div>
<svg class="clip-svg">
<defs>
<clipPath id="polygon-clip-rhomboid" clipPathUnits="objectBoundingBox">
<polygon points="0 1, 0.3 0, 1 0, 0.7 1" />
</clipPath>
</defs>
</svg>
</div>
什麼是當前顯示的視圖可以看出你可以這樣做只是通過利用在它有三個菱形更復雜的剪輯路徑here