I have to code a design like this:
I did everything as shown on the picture, but I ran into a problem. The angle of this polygon changes when the screen size changes, but I need it to be consistent to match the angle of the hexagon logo. I tried several things such as putting the triangle PNG as the header's background image - the angle is consistent but then the border gets too big on the larger screens and too small on the smaller screens and I need the border size to be consistent across all screen sizes as well (50px).
Hopefully someone can help. If you have a better way than using clip-path, I am open to that solution as well! Tips: Pattern (background-image) size is fixed, Logo size is fixed, Border size is fixed, the only thing that should scale is the polygon with consistent angle.
The code below matches for 1920px screen size width.
body {
background-color: #6e4d3c;
margin: 0;
padding: 0;
}
header {
background: #FFF;
height: 850px;
clip-path: polygon(
0 0, /* left top */
100% 0, /* right top */
100% 300px, /* right bottom */
50% 100%, /* center */
0 300px /* left bottom */
);
}
.clipped {
background: #99ffe7 url(http://i.pics.rs/70hBA.png) no-repeat top center;
height: 800px;
position: relative;
clip-path: polygon(
0 0, /* left top */
100% 0, /* right top */
100% 250px, /* right bottom */
50% 100%, /* center */
0 250px /* left bottom */
);
}
#logo {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 340px;
}
<header> <!-- serves as the white border -->
<div class="clipped">
<img id="logo" src="http://i.pics.rs/M7gQb.png" alt="Logo">
</div>
</header>