/ Gists / Non-Rectangular Headers
On gists

Non-Rectangular Headers

CSS CSS trick

index.html Raw #

<!--
https://css-tricks.com/creating-non-rectangular-headers/
https://github.com/kevin-powell/creative-section-shapes 
https://github.com/Kcko/creative-section-shapes
-->

<!--
1) inline svg
2) clip-path
3) transform: skewY
4) mask with svg pattern (KP) -> https://github.com/Kcko/creative-section-shapes
svg lze ruzne zmensovat a zvetsovat v css a vytvari to pokazde jine tvary 
-->


<!-- 1 -->
<header>
  <h1>Header Content</h1>
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="none">
    <polygon fill="white" points="0,100 100,0 100,100"/>
  </svg>
</header>

<style>
  header {
  position: relative;
  height: 300px;
  background-image: linear-gradient(#ff9d2f, #ff6126);
}

svg {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 10vw;
  /* set height to pixels if you want angle to change with screen width */
}
</style>


<!--
2
-->
<style>
  header {
  position: relative;
  height: 300px;
  background-image: linear-gradient(#ff9d2f, #ff6126);
  clip-path: polygon(
    0 0,
    100% 0,
    100% 100%,
    0 calc(100% - 5vw)
  );
  /* change the calc height to a percentage height to get alternate responsive behavior*/
}
</style>