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.
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.

