How can I add a white border inside the shape like this?
The code below was from https://stackoverflow.com/a/65504158.
I just made some slight changes.
.hexagon {
width: 200px;
display: inline-block;
margin: 0 5px;
color: orange;
filter: url("#goo");
}
.mask {
display: block;
background: currentColor;
padding-top: 115%; /* 100%/cos(30) */
clip-path: polygon(0% 25%, 0% 75%, 50% 100%, 100% 75%, 100% 25%, 50% 0%);
}
img {
position: absolute;
top:0;
bottom: 0;
left: 0;
right:0;
width: 100%;
height: 100%;
}
<div class="hexagon">
<div class="mask">
<img src="https://images.unsplash.com/photo-1724884564497-f5024b7e2f93?q=80&w=257" />
</div>
</div>
<svg style="visibility: hidden; position: absolute;" width="0" height="0" xmlns="http://www.w3.org/2000/svg" version="1.1">
<defs>
<filter id="goo">
<feGaussianBlur in="SourceGraphic" stdDeviation="8" result="blur" />
<feColorMatrix in="blur" mode="matrix" values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 19 -9" result="goo" />
<feComposite in="SourceGraphic" in2="goo" operator="atop" />
</filter>
</defs>
</svg>
I tried to add the border property to the hexagon but it wouldn’t show.
2
Answers
You should put another tag nearby image you have write code for that…..
you will be archive the code…