Iam試圖圍繞圖像製作雙六邊形邊框。這裏是我的小提琴,它沒有來遠:圖像周圍的兩個六邊形邊框(響應式)
https://jsfiddle.net/qeh8wdsd/
代碼:
<div class="hex">
<div class="hex inner">
<div class="hex inner2">
<img src="http://www.jqueryscript.net/images/Simplest-Responsive-jQuery-Image-Lightbox-Plugin-simple-lightbox.jpg"/>
</div>
</div>
</div>
.hex {
margin-top: 70px;
width: 208px;
height: 120px;
background: #000;
position: relative;
}
.hex:before, .hex:after {
content:"";
border-left: 104px solid transparent;
border-right: 104px solid transparent;
position: absolute;
}
.hex:before {
top: -59px;
border-bottom: 60px solid #000;
}
.hex:after {
bottom: -59px;
border-top: 60px solid #000;
}
.hex.inner {
background-color:blue;
-webkit-transform: scale(.8, .8);
-moz-transform: scale(.8, .8);
transform: scale(.8, .8);
z-index:1;
}
.hex.inner:before {
border-bottom: 60px solid blue;
}
.hex.inner:after {
border-top: 60px solid blue;
}
.hex.inner2 {
background-color:red;
-webkit-transform: scale(.8, .8);
-moz-transform: scale(.8, .8);
transform: scale(.8, .8);
z-index:2;
}
.hex.inner2:before {
border-bottom: 60px solid red;
}
.hex.inner2:after {
border-top: 60px solid red;
}
,所以我希望圖像是其中紅色六角形的,基本上是形象應該是內部和「剪切「到一個六邊形,然後我想要一個藍色和黑色邊框,每個大約2px。第二個問題是我想讓它響應。希望任何人都能幫助我實現這一點。
我找到了一個很好的部分解決方案在這裏https://stackoverflow.com/questions/34240589/hexagon-with-border-and-image/34263694#34263694但我需要添加另一個六角形邊框當前 – mheonyae