I am in the process of designing the navigation menu for my website and I have a specific vision in mind. I want to create a unique background using two rectangular SVGs that are slightly rotated off axis and overlapping each other, with their edges extending beyond the screen's boundaries. The height of the SVGs should remain constant at 120px across all breakpoints, and the navigation content should be vertically centered within the container, even though the rotation may make it appear off-center. However, I'm facing challenges with the SVG heights shrinking when resizing the browser window and alignment issues. Is there a better approach to achieve this design?
.hero-bg {
height:20vh;
min-height:200px;
max-height:350px;
width:100%;
background:url('http://placehold.it/1920x1080');
background-size:cover;
}
.navigation {
position:relative;
height:120px;
overflow:hidden;
}
.nav-bg-1 {
fill:red;
}
.nav-bg-2 {
fill:black;
}
.navigation svg {
position:absolute;
top:-10px;
width:110%;
left:-5%;
}
.navigation ul {
list-style-type:none;
padding:0;
margin:0;
position:absolute;
top:50%;
transform:translateY(-50%);
}
.navigation ul > li {
display:inline-block;
}
.navigation ul > li > a{
color:#fff;
text-transform:uppercase;
text-decoration:none;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/css/bootstrap.min.css" rel="stylesheet"/>
<section id="hero">
<div class="hero-bg"></div>
<div class="navigation">
<svg viewBox="0 0 2027.79 155.34">
<rect class="nav-bg-1" x="953.89" y="-935.33" width="120" height="2026" transform="translate(918.54 1090.05) rotate(-89)"/>
<rect class="nav-bg-2" x="0.89" y="14.67" width="2026" height="120" transform="translate(-0.32 4.42) rotate(-0.25)"/>
</svg>
<div class="container">
<div class="row">
<div class="col-sm-4 hidden-xs">
<!-- LOGO -->
</div>
<div class="col-sm-8">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Products</a></li>
<li><a href="#">Contact</a></li>
</ul>
</div>
</div>
</div>
</div>
</section>
After achieving the background bars as intended, my next step is to animate them and modify their shapes slightly as the user scrolls, utilizing MorphSVG. It is essential that the solution involves using SVG instead of alternative methods.
Here is a visual representation of my desired outcome. While the navigation will be contained within a specific area, the red and black bars should extend to the edge of the screen regardless of the screen size: