While attempting to convert a PSD to HTML, I encountered a small issue. Please refer to the image below:
https://i.sstatic.net/5KoIV.jpg
As indicated by the red arrow, there is a blue background image in the header of the template! How can I add this background with a responsive and stable position that adjusts even when the browser size changes? The background should always occupy 70% of the screen (ending between the logo and the first nav-item).
Here is the link to the code on jsfiddle: https://jsfiddle.net/4dpgbLt9/2/
html,
body {
height: 100%;
}
body {
font-family: IranSans, sans-serif;
}
.header {
height: 100vh;
width: 100vh;
background: url("https://i.imgur.com/aN7jCZE.png") left no-repeat;
background-size: contain;
}
.navbar {
direction: rtl;
padding-top: 16px;
}
.nav-item .nav-link {
font-size: 16px;
padding: 0 20px 0 20px !important;
}
.nav-item.active .nav-link {
color: #ffd738 !important;
}
.nav-item .nav-link {
color: #ffffff !important;
}
.nav-account-parent {
position: relative;
}
.nav-account {
position: absolute;
width: 100%;
height: 100px;
top: -50px;
z-index: -1;
background-color: #025c64;
border-radius: 16px;
}
.navbar-brand img {
width: 220px;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" />
<html lang="en">
<body>
<nav class="navbar navbar-expand-md navbar-light bg-transparent justify-content-center">
<div class="container">
<a class="navbar-brand" href="#">
<img src="https://i.imgur.com/gURHBju.png" alt="Logo">
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="collapsibleNavbar">
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="#">صفحه اصلی</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">درباره ما</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">درخواست مشاوره</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">خدمات</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">فروشگاه</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">ارتباط با ما</a>
</li>
<li class="nav-item nav-account-parent">
<div class="nav-account"></div>
<a class="nav-link" href="#">ورود / عضویت</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="header">
</div>
Thank you for your assistance ♥