CSS Rotated (diagonal) div, sections, navbar and footer, use svg or just transform skew, what to use?

Viewed 547

I'm starting as a front-end web developer. Currently, I'm having trouble when trying to implement a layout for a customer website.

The designer is asking for a layout like this.

enter image description here

As you can see, the layout is not rectangular, the navbar and also the footer, and a lot of the website sections are diagonal.

I googled a lot and I found 2 methods of achieving that.

The first method is by creating some SVG and adding those as background in CSS for everything that is rotated. This causes a problem when the screen is resized. If the viewport of the user is very wide, the rotating effect is lost a bit because the SVG is stretched.

The second method I found is by applying a transform skew for every section and content inside to avoid rotated text. That is a lot of work because I have to apply the rotation practically in every element of the website. However, it wins flexibility against the first method because with media query I can fix the rotation if the effect is getting lost.

Did anyone face this problem before? I'm approaching correctly the problem? What method would you use? Does anyone know about other methods to solve this problem?

UPDATE

After having seen some of your help I started to code applying the answers. Thank you to @A Haworth, @G-Cyrillus, @Nathan

I have not found a way to make the right part of the image hidden by the bar. Maybe I could tint the last option of the linear-gradient as the background color. Does anyone have a better solution?

Here is the code.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>title</title>

    <meta content="width=device-width, initial-scale=1" name="viewport">
    <link href="favicon.ico" rel="icon" type="image/x-icon">
    <style>
        *,
        *::after,
        *::before,
        html {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        .nav {
            width: 100%;
            height: 100px;

            position: fixed;
            top: 0;
            left: 0;
            background-color: white;
            z-index: 999;
        }

        .nav::after {
            content: '';
            width: 100%;
            height: 175%;
            display: inline-block;
            background: linear-gradient(178.5deg, white 65%, #dfa557 65.3%, #dfa557 75%, transparent 75.3%);
        }

        .nav svg {
            max-height: 100px;
            position: absolute;
        }

        .nav svg:nth-child(2) {
            float: right;
            top: 30px;
            right: 30px;
        }

        .content {
            width: 100%;
            margin-top: 100px;
            position: relative;
        }

        .content img {
            max-width: 100%;
            vertical-align: bottom;
        }

        .content .img::after {
            content: '';
            width: 100%;
            height: 75px;
            background: linear-gradient(178.5deg, transparent 49px, #dfa557 50px, #dfa557 74px, transparent 75px);
            float: left;
            position: relative;
            margin-top: -60px;
        }

        .content p {
            padding: 1rem;
            background-color: #73392c;
            width: 15em;
            text-align: center;
            transform: translateX(-50%) rotateZ(-2deg);
            color: white;
            float: left;
            position: relative;
            margin-left: 50%;
            margin-top: -80px;
        }
    </style>
<body>

<div class="nav">
    <svg data-name='Layer 1' id='logoipsum' viewBox='0 0 177.78 100' xmlns='http://www.w3.org/2000/svg'><title>
        logo-5</title>
        <path d='M63.87,44.07h3V56.2h-3Zm4.19,7.55c0-3,1.84-4.79,4.68-4.79s4.68,1.79,4.68,4.79-1.8,4.8-4.68,4.8S68.06,54.67,68.06,51.62Zm6.35,0c0-1.65-.65-2.62-1.67-2.62s-1.66,1-1.66,2.62.63,2.6,1.66,2.6S74.41,53.3,74.41,51.63Zm4.14,5.17h2.88a1.55,1.55,0,0,0,1.62.9c1.14,0,1.74-.62,1.74-1.52V54.49h-.06A2.84,2.84,0,0,1,82,56.13c-2.19,0-3.64-1.67-3.64-4.54s1.38-4.68,3.68-4.68a2.87,2.87,0,0,1,2.76,1.76h0V47h3V56.1c0,2.19-1.93,3.55-4.78,3.55C80.37,59.65,78.72,58.46,78.55,56.8Zm6.25-5.18c0-1.46-.67-2.38-1.73-2.38s-1.71.91-1.71,2.38.64,2.3,1.71,2.3S84.8,53.1,84.8,51.62Zm4.13,0c0-3,1.84-4.79,4.68-4.79s4.69,1.79,4.69,4.79-1.8,4.8-4.69,4.8S88.93,54.67,88.93,51.62Zm6.35,0c0-1.65-.65-2.62-1.67-2.62S92,50,92,51.63s.63,2.6,1.65,2.6S95.28,53.3,95.28,51.63Zm4.16-6.79A1.53,1.53,0,1,1,101,46.31,1.46,1.46,0,0,1,99.44,44.84Zm0,2.2h3V56.2h-3Zm13.89,4.59c0,3-1.33,4.71-3.61,4.71a2.86,2.86,0,0,1-2.8-1.7h-.06v4.52h-3V47h3v1.64h.06a2.87,2.87,0,0,1,2.78-1.77C112,46.91,113.37,48.63,113.37,51.63Zm-3,0c0-1.46-.67-2.39-1.72-2.39s-1.72.94-1.73,2.39.68,2.38,1.73,2.38S110.33,53.08,110.33,51.63Zm8.15-4.8c2.49,0,4,1.18,4.07,3.07h-2.73c0-.65-.54-1.06-1.37-1.06s-1.2.32-1.2.79.33.62,1,.76l1.92.39c1.83.39,2.61,1.13,2.61,2.52,0,1.9-1.73,3.12-4.28,3.12s-4.22-1.22-4.35-3.09h2.89c.09.68.63,1.08,1.51,1.08s1.28-.29,1.28-.77-.28-.58-1-.73l-1.73-.37c-1.79-.37-2.73-1.32-2.73-2.72C114.39,48,116,46.83,118.48,46.83Zm14.31,9.37H129.9V54.47h-.06a2.61,2.61,0,0,1-2.66,1.91,3.19,3.19,0,0,1-3.36-3.45V47h3v5.24c0,1.09.56,1.67,1.49,1.67a1.53,1.53,0,0,0,1.52-1.73V47h3ZM134.24,47h2.9v1.77h.06a2.66,2.66,0,0,1,2.61-1.94,2.39,2.39,0,0,1,2.55,2h.06a2.82,2.82,0,0,1,2.82-2,2.91,2.91,0,0,1,3,3.12V56.2h-3V50.75c0-1-.45-1.46-1.29-1.46a1.31,1.31,0,0,0-1.31,1.48V56.2h-2.85V50.71c0-.92-.45-1.42-1.27-1.42a1.34,1.34,0,0,0-1.33,1.5V56.2h-3Z'
              style='fill:#394149'/>
        <path d='M55.48,44.62a13.25,13.25,0,0,0-2-3.22A13.53,13.53,0,1,0,34.8,60.72,13.09,13.09,0,0,0,38,62.55a13.39,13.39,0,0,0,5.07,1A13.56,13.56,0,0,0,56.6,50,13.39,13.39,0,0,0,55.48,44.62ZM43.06,39.19a10.71,10.71,0,0,1,4.52,1h0a4.39,4.39,0,0,1-1.08.31,5.73,5.73,0,0,0-4.85,4.85A3,3,0,0,1,38.94,48a5.73,5.73,0,0,0-4.85,4.85,2.91,2.91,0,0,1-.79,1.74h0a10.8,10.8,0,0,1,9.77-15.42ZM34.79,57c.12-.11.24-.21.36-.33a5.48,5.48,0,0,0,1.62-3.23,2.92,2.92,0,0,1,.87-1.82,2.83,2.83,0,0,1,1.81-.86,5.73,5.73,0,0,0,4.85-4.85A2.92,2.92,0,0,1,45.17,44,2.87,2.87,0,0,1,47,43.17a5.48,5.48,0,0,0,3-1.43,10.51,10.51,0,0,1,2.36,2.78.86.86,0,0,1-.13.14,2.87,2.87,0,0,1-1.81.88,5.71,5.71,0,0,0-4.85,4.85,3,3,0,0,1-2.69,2.68A5.76,5.76,0,0,0,38,57.92a3.14,3.14,0,0,1-.49,1.37A10.89,10.89,0,0,1,34.79,57Zm8.27,3.86a10.84,10.84,0,0,1-3-.42,5.78,5.78,0,0,0,.64-2,3,3,0,0,1,2.68-2.68,5.73,5.73,0,0,0,4.86-4.85,3,3,0,0,1,2.68-2.68,5.71,5.71,0,0,0,2.56-1A10.82,10.82,0,0,1,43.06,60.81Z'
              style='fill:#394149'/>
    </svg>
    <svg fill="none" height="46" viewBox="0 0 46 46" width="46" xmlns="http://www.w3.org/2000/svg"
         xmlns:xlink="http://www.w3.org/1999/xlink">
        <rect fill="url(#pattern0)" height="46" width="46"/>
        <defs>
            <pattern height="1" id="pattern0" patternContentUnits="objectBoundingBox" width="1">
                <use transform="translate(-0.0037037) scale(0.00740741)" xlink:href="#image0"/>
            </pattern>
            <image height="135" id="image0" width="136"
                   xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIgAAACHCAYAAADN7BGHAAAACXBIWXMAAAsSAAALEgHS3X78AAACK0lEQVR4nO3dsW0TURzA4ReUARgh2SBVWqDMBFhKkxFoUpOeghWMhKVsQBtaqkyAGYENjCxRIfyzLYUknL9P8gDv7ic96Z3v/kffP7+9GmOsf/Cnd8djjJMxxiuXhr94+cJVoQiEJBCSQEgCIQmEJBCSQEgCIQmEJBCSQEjHLs9kfBpj/NhhMa/3eTgrkOmYn17e3m1bzXIxu9knEFsMSSAkgZAEQhIISSAkgZAEQnJQNh1ny8Vsl8Wc7LNigUzHx3+xElsMSSAkgZAEQhIISSAkgZAEQhIISSCk9VH7fIyx9c+uHKT7o9Vq5dazkS2GJBCSQEgCIQmEJBCSQEgCIQmEJBCSQEhP9l7M9cX5jVvz7M2f8sWp9//JRTpkd7YYkkBIAiEJhCQQkkBIAiEJhCQQkkBIAiH5iN10mBdDmn/48m3rK7S/n6KbF8PDEAhJICSBkARCEghJICSBkByUTcfZ9cX5LosxL+ZAmRfD4xMISSAkgZAEQhIISSAkgZAEQhIISSCkp3wW89WtefZ+GihEssWQBEISCEkgJIGQBEISCEkgJIGQBEISCOl4uZid7Pu2FQfjfv0098pwHzZ4Y4shCYQkEJJASAIhCYQkEJJASAIhCYTkI3bTYV4MaX56ebt1XsxyMTMvhocjEJJASAIhCYQkEJJASAIhOSibjrPlYrbLYsyLOVDmxfD4BEISCEkgJIGQBEISCEkgJIGQBEISCEkgJIGw2RjjF5bMMooWWQ8lAAAAAElFTkSuQmCC"/>
        </defs>
    </svg>
</div>
<div class="content">
    <div class="img"><img
            src="https://i.picsum.photos/id/690/1920/1080.jpg?hmac=GGas7WQ8CNFLrnTOF_qILl5UBklCgc56yjrMKbzCGrM"/></div>
    <p>SECTION NAME</p>
</div>
<div style="padding-top: 100px">
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Animi aspernatur culpa, delectus dolorum et harum impedit, iure maiores molestias nemo possimus quae sunt tempora tenetur ullam unde vitae. Ex, maiores.</p>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Animi aspernatur culpa, delectus dolorum et harum impedit, iure maiores molestias nemo possimus quae sunt tempora tenetur ullam unde vitae. Ex, maiores.</p>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Animi aspernatur culpa, delectus dolorum et harum impedit, iure maiores molestias nemo possimus quae sunt tempora tenetur ullam unde vitae. Ex, maiores.</p>
</div>

</body>
</html>

Here is the screenshot of the error.

enter image description here

4 Answers

I'd sugest laying everything out in the conventional way, ie rectangles, and then when a sloping boundary is needed apply it as a pseudo element. That way you don't have to 'correct' anything in the normal text/images. And if you make the pseudo elements absolute they don't affect the natural flow of everything else. So for the beige looking polygon at the top you draw that as a rectangle with text in in the usual way and give it a pseudo element that draws an extra skewed bit on the bottom. And have it overlap the next div.

Something like:

.a {
  width:300px;
  height: 150px;
  background-color: beige;
}
.a::after {
  content: '';
  width: 100%;
  height: 250px;
  display: inline-block;
  transform: skewY(-20deg);
  background-image: linear-gradient(to bottom, beige, beige);
}
<div class="a">text stuff</div>

For the actually rotated text you will have to rotate the div it is in - not skew.

here is an idea mixing gradient and rotate and a few margins:

html {
  font-size: clamp(12px, 2.5vw, 20px);/* abiut responsive idea */
}
body {
  margin: auto;
  color: white;
  text-shadow: 0 0 1px black;
}
.bod {/* let's use a container to avoid growing too wide */
  max-width: 1200px;
  margin: auto;
  box-shadow: 0 0 1px gray, 0 0 0 50vw #dea45780;
}
nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  position: relative;
  overflow: hidden;
}
/* let's use a pseudo gradient a few times */
nav:after,
.content:after,
section:before {
  content: "";
  height: calc(40px + 1vw);/* responsive idea */
  width: 140%;
  margin: 0 -20%;
  display: block;
  background: linear-gradient(
    to bottom right,
    white 45%,
    #dfa557 46%,
    #dfa557 55%,
    transparent 56%
  );
}
h1,
h2,
p,
h3 {
  padding: 1rem;
  margin: 0.5rem;
}
nav svg {
  max-height: 100px;
  margin-right: 3vw;
}
.content {
  overflow: hidden;
  margin-top: calc((40px + 1vw) * -1);/* hide it partially */
  display: grid;
  grid-auto-rows: auto;/* to dispatch element over the image instead absolute positionning */
}
.content img {
  max-width: 100%;
  min-height: 400px;
  margin-bottom: 0.75em;
  object-fit: cover;/* clip it if needed */
  grid-column: 1;
  grid-row: 1/6;
}
.content h1 {
  grid-column: 1;
  grid-row: 2;
}
.content h2 {
  grid-column: 1;
  grid-row: 3;
}
.content h1,
.content h2 {
  background: linear-gradient(
    to top,
    transparent 1.25rem,
    #dfa557 1.25rem,
    #dfa557 2.25rem,
    transparent 2.25rem
  );
  font-size: 3rem;
  text-transform: uppercase;
  width: max-content;
}
.content h3 {
  grid-column: 1;
  grid-row: 5 / 6;
  margin: auto;
  transform: rotate(-3deg);/* rotate it a bit to match gradient rotation */
  background: #73392c;
  z-index: 1;
}
.content:after {
  grid-column: 1;
  grid-row: 5;
  transform: scale(-1);
}
section {
  mix-blend-mode: color-burn;/* blend with previous tag to  not hide */
  position: relative;
  z-index: 1;
  overflow: hidden;
  background: #8f250c;
}
section:before {
  transform: scale(-1, 1);
}
 

<div class="bod"><nav>
    <svg data-name='Layer 1' id='logoipsum' viewBox='0 0 177.78 100' xmlns='http://www.w3.org/2000/svg'><title>
        logo-5</title>
        <path d='M63.87,44.07h3V56.2h-3Zm4.19,7.55c0-3,1.84-4.79,4.68-4.79s4.68,1.79,4.68,4.79-1.8,4.8-4.68,4.8S68.06,54.67,68.06,51.62Zm6.35,0c0-1.65-.65-2.62-1.67-2.62s-1.66,1-1.66,2.62.63,2.6,1.66,2.6S74.41,53.3,74.41,51.63Zm4.14,5.17h2.88a1.55,1.55,0,0,0,1.62.9c1.14,0,1.74-.62,1.74-1.52V54.49h-.06A2.84,2.84,0,0,1,82,56.13c-2.19,0-3.64-1.67-3.64-4.54s1.38-4.68,3.68-4.68a2.87,2.87,0,0,1,2.76,1.76h0V47h3V56.1c0,2.19-1.93,3.55-4.78,3.55C80.37,59.65,78.72,58.46,78.55,56.8Zm6.25-5.18c0-1.46-.67-2.38-1.73-2.38s-1.71.91-1.71,2.38.64,2.3,1.71,2.3S84.8,53.1,84.8,51.62Zm4.13,0c0-3,1.84-4.79,4.68-4.79s4.69,1.79,4.69,4.79-1.8,4.8-4.69,4.8S88.93,54.67,88.93,51.62Zm6.35,0c0-1.65-.65-2.62-1.67-2.62S92,50,92,51.63s.63,2.6,1.65,2.6S95.28,53.3,95.28,51.63Zm4.16-6.79A1.53,1.53,0,1,1,101,46.31,1.46,1.46,0,0,1,99.44,44.84Zm0,2.2h3V56.2h-3Zm13.89,4.59c0,3-1.33,4.71-3.61,4.71a2.86,2.86,0,0,1-2.8-1.7h-.06v4.52h-3V47h3v1.64h.06a2.87,2.87,0,0,1,2.78-1.77C112,46.91,113.37,48.63,113.37,51.63Zm-3,0c0-1.46-.67-2.39-1.72-2.39s-1.72.94-1.73,2.39.68,2.38,1.73,2.38S110.33,53.08,110.33,51.63Zm8.15-4.8c2.49,0,4,1.18,4.07,3.07h-2.73c0-.65-.54-1.06-1.37-1.06s-1.2.32-1.2.79.33.62,1,.76l1.92.39c1.83.39,2.61,1.13,2.61,2.52,0,1.9-1.73,3.12-4.28,3.12s-4.22-1.22-4.35-3.09h2.89c.09.68.63,1.08,1.51,1.08s1.28-.29,1.28-.77-.28-.58-1-.73l-1.73-.37c-1.79-.37-2.73-1.32-2.73-2.72C114.39,48,116,46.83,118.48,46.83Zm14.31,9.37H129.9V54.47h-.06a2.61,2.61,0,0,1-2.66,1.91,3.19,3.19,0,0,1-3.36-3.45V47h3v5.24c0,1.09.56,1.67,1.49,1.67a1.53,1.53,0,0,0,1.52-1.73V47h3ZM134.24,47h2.9v1.77h.06a2.66,2.66,0,0,1,2.61-1.94,2.39,2.39,0,0,1,2.55,2h.06a2.82,2.82,0,0,1,2.82-2,2.91,2.91,0,0,1,3,3.12V56.2h-3V50.75c0-1-.45-1.46-1.29-1.46a1.31,1.31,0,0,0-1.31,1.48V56.2h-2.85V50.71c0-.92-.45-1.42-1.27-1.42a1.34,1.34,0,0,0-1.33,1.5V56.2h-3Z'
              style='fill:#394149'/>
        <path d='M55.48,44.62a13.25,13.25,0,0,0-2-3.22A13.53,13.53,0,1,0,34.8,60.72,13.09,13.09,0,0,0,38,62.55a13.39,13.39,0,0,0,5.07,1A13.56,13.56,0,0,0,56.6,50,13.39,13.39,0,0,0,55.48,44.62ZM43.06,39.19a10.71,10.71,0,0,1,4.52,1h0a4.39,4.39,0,0,1-1.08.31,5.73,5.73,0,0,0-4.85,4.85A3,3,0,0,1,38.94,48a5.73,5.73,0,0,0-4.85,4.85,2.91,2.91,0,0,1-.79,1.74h0a10.8,10.8,0,0,1,9.77-15.42ZM34.79,57c.12-.11.24-.21.36-.33a5.48,5.48,0,0,0,1.62-3.23,2.92,2.92,0,0,1,.87-1.82,2.83,2.83,0,0,1,1.81-.86,5.73,5.73,0,0,0,4.85-4.85A2.92,2.92,0,0,1,45.17,44,2.87,2.87,0,0,1,47,43.17a5.48,5.48,0,0,0,3-1.43,10.51,10.51,0,0,1,2.36,2.78.86.86,0,0,1-.13.14,2.87,2.87,0,0,1-1.81.88,5.71,5.71,0,0,0-4.85,4.85,3,3,0,0,1-2.69,2.68A5.76,5.76,0,0,0,38,57.92a3.14,3.14,0,0,1-.49,1.37A10.89,10.89,0,0,1,34.79,57Zm8.27,3.86a10.84,10.84,0,0,1-3-.42,5.78,5.78,0,0,0,.64-2,3,3,0,0,1,2.68-2.68,5.73,5.73,0,0,0,4.86-4.85,3,3,0,0,1,2.68-2.68,5.71,5.71,0,0,0,2.56-1A10.82,10.82,0,0,1,43.06,60.81Z'
              style='fill:#394149'/>
    </svg>
    <svg fill="none" height="46" viewBox="0 0 46 46" width="46" xmlns="http://www.w3.org/2000/svg"
         xmlns:xlink="http://www.w3.org/1999/xlink">
        <rect fill="url(#pattern0)" height="46" width="46"/>
        <defs>
            <pattern height="1" id="pattern0" patternContentUnits="objectBoundingBox" width="1">
                <use transform="translate(-0.0037037) scale(0.00740741)" xlink:href="#image0"/>
            </pattern>
            <image height="135" id="image0" width="136"
                   xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIgAAACHCAYAAADN7BGHAAAACXBIWXMAAAsSAAALEgHS3X78AAACK0lEQVR4nO3dsW0TURzA4ReUARgh2SBVWqDMBFhKkxFoUpOeghWMhKVsQBtaqkyAGYENjCxRIfyzLYUknL9P8gDv7ic96Z3v/kffP7+9GmOsf/Cnd8djjJMxxiuXhr94+cJVoQiEJBCSQEgCIQmEJBCSQEgCIQmEJBCSQEjHLs9kfBpj/NhhMa/3eTgrkOmYn17e3m1bzXIxu9knEFsMSSAkgZAEQhIISSAkgZAEQnJQNh1ny8Vsl8Wc7LNigUzHx3+xElsMSSAkgZAEQhIISSAkgZAEQhIISSCk9VH7fIyx9c+uHKT7o9Vq5dazkS2GJBCSQEgCIQmEJBCSQEgCIQmEJBCSQEhP9l7M9cX5jVvz7M2f8sWp9//JRTpkd7YYkkBIAiEJhCQQkkBIAiEJhCQQkkBIAiH5iN10mBdDmn/48m3rK7S/n6KbF8PDEAhJICSBkARCEghJICSBkByUTcfZ9cX5LosxL+ZAmRfD4xMISSAkgZAEQhIISSAkgZAEQhIISSCkp3wW89WtefZ+GihEssWQBEISCEkgJIGQBEISCEkgJIGQBEISCOl4uZid7Pu2FQfjfv0098pwHzZ4Y4shCYQkEJJASAIhCYQkEJJASAIhCYTkI3bTYV4MaX56ebt1XsxyMTMvhocjEJJASAIhCYQkEJJASAIhOSibjrPlYrbLYsyLOVDmxfD4BEISCEkgJIGQBEISCEkgJIGQBEISCEkgJIGw2RjjF5bMMooWWQ8lAAAAAElFTkSuQmCC"/>
        </defs>
    </svg>
</nav>
<div class="content"> 
  <img  src="https://i.picsum.photos/id/690/1920/1080.jpg?hmac=GGas7WQ8CNFLrnTOF_qILl5UBklCgc56yjrMKbzCGrM"/>
  <h1>Slogum</h1>
  <h2>Slogum</h2>
    <h3>SECTION NAME</h3>
  <section>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Animi aspernatur culpa, delectus dolorum et harum impedit, iure maiores molestias nemo possimus quae sunt tempora tenetur ullam unde vitae. Ex, maiores.</p>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Animi aspernatur culpa, delectus dolorum et harum impedit, iure maiores molestias nemo possimus quae sunt tempora tenetur ullam unde vitae. Ex, maiores.</p>
    <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Animi aspernatur culpa, delectus dolorum et harum impedit, iure maiores molestias nemo possimus quae sunt tempora tenetur ullam unde vitae. Ex, maiores.</p>
  </section>
</div>
</div>

/* there is a few comments inside the css part to tell purpose of some rules */

You could set the header and footer elements to contain a position:relative; and then use a position:absolute; psuedo ::before / ::after elements to create a skewed element that sits behind the content with it's respective top / bottom position depending on whether this is the header or footer.

header {
position:relative;
  &::after { 
    position:absolute; bottom:0; left:0; z-index:-1; width:100%; height:100%; background:white; border-bottom:.3125em solid orange; -webkit-transform: skewY(3deg); -moz-transform: skewY(3deg); -ms-transform: skewY(3deg); -o-transform: skewY(3deg); transform: skewY(3deg); content:'';
  }
}

I solved this with clip-path: polygon(...) propertie of css.

it's like drawing points to make your own figure and is very responsive. this should look like what you are looking for clip-path: polygon(0 0, 100% 0%, 100% 60%, 0% 100%); it has to be inside some div or container

example here

docs here

Related