-3

i have a question for u. For example i got this picture, and need to do background image width box-shadow (yellow) on It with photo of someone (doesn't matter). How can i do it right?

*Updated Image!

codezavr
  • 21
  • 4

1 Answers1

2

A task like this is best achieved with SVG, as it allows you to define complex shapes.

<svg viewBox="0 0 120 100" style="width:120px;height:100px">
  <defs>
    <clipPath id="hexagon_clip">
      <path id="hexagon" d="M38,2 
           L82,2 
           A12,12 0 0,1 94,10 
           L112,44 
           A12,12 0 0,1 112,56
           L94,90       
           A12,12 0 0,1 82,98
           L38,98
           A12,12 0 0,1 26,90
           L8,56
           A12,12 0 0,1 8,44
           L26,10
           A12,12 0 0,1 38,2" />
      <!-- SVG Hexagon path from http://stackoverflow.com/a/36842587/507674 -->
    </clipPath>
  </defs>
  <image xlink:href="http://placehold.it/120x100" x="0" y="0" width="120px" height="100px" clip-path="url(#hexagon_clip)" />
  <use xlink:href="#hexagon" x="0" y="0" stroke="orange" stroke-width="5" fill="transparent" />
</svg>

What happens here is that a clipping path is defined for the hexagon, then applied to the image. Finally, the hexagon is drawn again over the top to make the border.

Niet the Dark Absol
  • 320,036
  • 81
  • 464
  • 592