I need to create header on my web, but I have problem with coding it. I don't know how to code the container with navigation, which will be start just after logo but I do not want to use percentages for responsiveness and I need to background which will continue after the navigation. The circle on the image is logo.
The problem which I have is, I can not how to to with background like on the picture 2 but responsive and with container.
I have this code:
.site-nav {
width: 100%;
height: 230px;
background: #fee17c;
}
.site-nav .nav-logo {
height: 230px;
float: left;
display: flex;
}
.site-nav .nav-logo img {
height: 160px;
margin: auto;
}
.site-nav .nav-links {
height: 230px;
float: right;
}
.site-nav .nav-links .nav-links-box {
height: 230px;
display: flex;
}
@media (min-width: 768px) {
.site-nav .nav-links .nav-links-box ul {
list-style: none;
margin: 0;
padding: 0;
margin: auto;
background: url(../img/obd-ln-k-1.png);
background-repeat: no-repeat;
background-size: 100% 100%;
padding: 1rem 0 1rem 0;
}
.site-nav .nav-links .nav-links-box ul li {
margin: 0;
padding: 0;
padding: .7rem 1rem .7rem 0;
text-transform: uppercase;
float: right;
margin: auto;
padding-left: 1rem;
}
.site-nav .nav-links .nav-links-box ul li:not(:last-child) {
padding-right: 1rem;
}
.site-nav .nav-links .nav-links-box ul li a {
color: black;
text-decoration: none;
font-size: 20px;
transition: .5s;
}
.site-nav .nav-links .nav-links-box ul li a:hover {
color: #0864bb;
}
}
@media (max-width: 768px) {
.site-nav .nav-links .nav-links-box ul {
list-style: none;
margin: 0;
padding: 0;
width: 100%;
position: absolute;
top: 230px;
left: 0;
background: 768px-bg;
z-index: 9999;
display: none;
border-bottom: 2px solid #fee17c;
box-shadow: 0 8px 15px 0 rgba(0, 0, 0, 0.08);
}
.site-nav .nav-links .nav-links-box ul li {
padding: 1rem 0 1rem 1.5rem;
}
.site-nav .nav-links .nav-links-box ul.show {
display: block;
}
}
.site-nav .nav-links .toggle-nav {
width: 35px;
height: 230px;
border: 0;
background: none;
padding: 0;
margin: 0;
position: relative;
cursor: pointer;
outline: none;
display: none;
}
@media (max-width: 768px) {
.site-nav .nav-links .toggle-nav {
display: block;
}
}
.site-nav .nav-links .toggle-nav .dashes {
display: block;
width: 100%;
position: relative;
z-index: 2;
}
.site-nav .nav-links .toggle-nav .dashes .dash {
display: block;
width: 100%;
height: 3px;
background-color: #0864bb;
transform-origin: 50% 50%;
transition: transform .4s,-webkit-transform .4s;
}
.site-nav .nav-links .toggle-nav .dashes .dash:not(:first-child) {
margin-top: 6px;
}
.site-nav .nav-links .toggle-nav.show .dashes .dash:nth-child(1) {
transform: translateY(9px) rotate(45deg);
}
.site-nav .nav-links .toggle-nav.show .dashes .dash:nth-child(2) {
visibility: hidden;
}
.site-nav .nav-links .toggle-nav.show .dashes .dash:nth-child(3) {
transform: translateY(-9px) rotate(-45deg);
}
<nav class="site-nav">
<div class="container">
<div class="nav-logo">
<img src="assets/frontend/img/logo.png" alt="">
</div><!-- .nav-logo -->
<div class="nav-links">
<button class="toggle-nav">
<span class="dashes" aria-hidden="true">
<span class="dash"></span>
<span class="dash"></span>
<span class="dash"></span>
</span>
<span class="txt">Menu</span>
</button><!-- .toggle-nav -->
<div class="nav-links-box">
<ul class="nav-list">
<li><a href="/">Home</a></li>
<li><a href="/">Home</a></li>
<li><a href="/">Home</a></li>
<li><a href="/">Home</a></li>
<li><a href="/">Home</a></li>
<li><a href="/">Home</a></li>
</ul>
</div>
</div><!-- .nav-links -->
</div><!-- .container -->
</nav><!-- .site-nav -->
Aucun commentaire:
Enregistrer un commentaire