Overflow issue with burger menu - html

I'm trying to learn how to create burger menus for the mobile version of the site. I've managed to create a simple burger-menu with a little help of js, but I faced the problem with overflow. Burger works fine, but it has a sidescroll when it's unactive. I understand that it could be fixed with position: relative and overflow: hidden, but I can't figure out to which block I should apply those parameters. When I try to apply this parameters to the parent header block, burger menu becomes the header's hight. Can't really understand how to avoid it.
HTML:
`<header class="header">
<div class="header__container">
<a href="#"
><div class="logo__block">
<img src="img/logo.svg" alt="Logo" /></div
></a>
<nav class="header__nav nav">
<ul class="nav__list">
<div class="burger-menu__exit">X</div>
<li class="nav__item">
Home
</li>
<li class="nav__item">
Features
</li>
<li class="nav__item">
Pricing
</li>
<li class="nav__item">
Blog
</li class="nav__item nav-btn">
</ul>
</nav>
<a class="header-btn" href="#">Get Started</a>
<div class="burger-menu">
<div class="line line1"></div>
<div class="line line2"></div>
<div class="line line3"></div>
</div>
</div>
</header>`
CSS:
`body {
font-family: "Libre Franklin", sans-serif;
}
[class$="__container"] {
max-width: 1270px;
margin: 0 auto;
padding: 0 15px;
}
.header__container {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
line-height: 60px;
padding-top: 40px;
padding-bottom: 60px;
}
.header__container:before{
position: relative;
}
.logo__block {
display: flex;
align-items: center;
}
.nav {
margin-left: auto;
}
.nav__list {
display: flex;
flex-direction: row;
justify-content: flex-end;
}
.nat__item {
}
.nav-btn {
display: none;
}
.nav__list > li:not(.nav__item:last-child) {
margin-right: 100px;
}
.nav__item:last-child {
margin-right: 79px;
}
.nav__link {
font-style: normal;
font-weight: 400;
font-size: 20px;
}
.nav__link:hover {
border-bottom: 2px solid black;
}
.btn__block {
max-width: 286px;
}
.header-btn {
width: 211px;
text-align: center;
border-radius: 10px;
font-style: normal;
font-weight: 500;
font-size: 20px;
color: white;
background-color: #ff7143;
transition: 0.3s;
}
.header-btn:hover {
background-color: #d1542b;
}
.burger-menu {
display: none;
margin-left: 10px;
cursor: pointer;
}
.burger-menu__exit {
display: none;
}
.line {
width: 35px;
height: 2px;
background-color: black;
margin-top: 10px;
}
.line1 {
margin-top: 0;
}
#media (max-width: 1309px) {
[class$="__container"] {
max-width: 1103px;
}
}
#media (max-width: 1129px) {
[class$="__container"] {
max-width: 1000px;
}
.nav__list > li:not(.nav__item:last-child) {
margin-right: 50px;
}
.nav__item:last-child {
margin-right: 79px;
}
}
#media (max-width: 988.98px) {
[class$="__container"] {
max-width: none;
}
.burger-menu {
display: block;
}
.header__nav {
background-color: #5454d4;
z-index: 9999;
}
.nav {
position: absolute;
top: 0;
left: 100%;
right: -100%;
z-index: 999;
min-width: 375px;
height: 100vh;
padding-top: 30px;
color: #ff7143;
transition: 1s;
}
.nav__list {
position: relative;
flex-direction: column;
align-items: center;
justify-content: center;
}
.nav__list a {
color: #ff7143;
}
.nav__list a:hover {
border-bottom: 2px solid #ff7143;
}
.nav__list > li:not(.nav__item:last-child) {
margin-right: 0;
}
.nav__item:last-child {
margin-right: 0;
}
.header-btn {
margin-left: auto;
}
.burger-menu__exit {
display: block;
cursor: pointer;
position: absolute;
top: 0;
right: 18px;
font-size: 40px;
}
}
#media (max-width: 512.98px) {
.header-btn {
display: none;
}
}
#media (max-width: 369.98px) {
.nav {
min-width: 100%;
}
}`
JS:
const mobileNav = document.querySelector(".nav");
const headerButton = document.querySelector(".header-btn");
const headerContainer = document.querySelector(".header__container");
document.querySelector(".burger-menu").addEventListener("click", () => {
mobileNav.style.right = 0;
});
document.querySelector(".burger-menu__exit").addEventListener("click", () => {
mobileNav.style.right = -100 + "%";
});
Thanks for the help!

Issue was fixed by adding the different navigation for burger outside the header block and adding the position: relative; overflow: hidden; to the html and body.

Related

My HTML and CSS nav bar is not working on IPhones

So I have been coding a website with some friends for our robotics team and have run into a problem with our nav bar. It works well for any PC/laptop/mac books and Android devicesWorking nav bar on Android phone but on all iPhones the nav bar is stretched Screen shot of the stretched nav bar. Here is the CSS and HTML code that we have `
body {
background-color: rgb(90, 88, 88);
margin: 0;
padding: 0;
user-select: none;
}
#img {
width: 5.6%;
height: 100%;
}
#topBar {
position: fixed;
list-style-type: none;
width: 100%;
height: 10%;
display: inline-block;
overflow: hidden;
background-color: #333;
z-index: 999;
}
.topbar-section {
color: white;
text-align: center;
padding: 1.5rem .5rem;
display: inline-block;
font-family: "Helvetica ", sans-serif;
font-weight: 100;
width: 10vw;
height: 100%;
}
#h {
color: rgb(253, 253, 253);
font-family: "Helvetica ", sans-serif;
text-decoration: none;
font-weight: 100;
font-size: 100%;
}
#heo {
display: inline-block;
text-align: center;
padding: 1.6rem 0.6%;
}
.tabs {
font-size: 100%;
font-weight: 100;
}
.topbar-section:hover {
background-color: #111;
}
.Toggle {
position: absolute;
top: 2.1rem;
right: 1rem;
display: none;
flex-direction: column;
justify-content: space-between;
width: 30px;
height: 21px;
}
.Toggle .bar {
height: 3px;
width: 100%;
background-color: white;
border-radius: 10px;
}
#con {
margin-right: 10px;
float: right;
margin: 0;
padding: 0;
}
.active {
display: block;
}
#media(max-width: 1050px) {
.Toggle {
position: absolute;
top: 4vh;
right: 1rem;
}
.Toggle {
display: flex;
}
#img {
width: 8%;
}
#topbar {
height: auto;
}
.topbar-section {
display: block;
}
.topbar-section {
width: 100%;
padding: .7rem;
}
#con {
text-align: center;
width: 100%;
margin-right: 0;
}
.active {
display: none;
}
.HomeTexpandlogo {
display: block;
width: 10%;
height: 10%;
}
#h {
font-size: 80%;
}
}
#media(max-width: 450px) {
#h {
font-size: 60%;
}
}
<div id="topBar">
<img id="img" src="images/txpand_logo-removebg-preview.png">
<div id="heo">
<h1 id="h">Expanding STEM skills through robotics</h1>
</div>
<a href="#" class="Toggle" id="toggle-button">
<span class="bar"></span>
<span class="bar"></span>
<span class="bar"></span>
</a>
<div id="con" class="active">
<div class="topbar-section" id="homeTab">
<span class="tabs">Home</span>
</div>
<div class="topbar-section" id="aboutUsTab">
<span class="tabs">About us</span>
</div>
<div class="topbar-section" id="outreachTab">
<span class="tabs">Outreach</span>
</div>
<div class="topbar-section" id="pastRobotsTab">
<span class="tabs">Past Robots</span>
</div>
<div class="topbar-section" id="sponsorshipsTab">
<span class="tabs">Sponsorships</span>
</div>
<div class="topbar-section" id="donationsTab" style="display:none;">
<span class="tabs">Donations</span>
</div>
</div>
</div>
Has anyone else run in to this problem and know how to fix it?
Thanks for the help in advance.

How to keep focus on a custom dropdown after making selection?

I have a custom dropdown and I've set up focus states on the dropdown and the items in it. But, when I select an item from the first menu, the focus goes to the nav and not the next dropdown. Is there a way to target the second dropdown after the first one?
Here's a Codepen if you'd prefer.
for (const dropdown of document.querySelectorAll(".custom__select-wrapper:not(.clearFilter)")) {
dropdown.addEventListener("click", function () {
this.querySelector(".custom__select").classList.toggle("open");
});
}
for (const option of document.querySelectorAll(".custom__option")) {
option.addEventListener("click", function () {
if (!this.classList.contains("selected")) {
this.parentNode
.querySelector(".custom__option.selected")
.classList.remove("selected");
this.classList.add("selected");
this.closest(".custom__select").querySelector(
".custom__select-trigger h6"
).textContent = this.textContent;
if (this.getAttribute("data-type")) {
current_story = this.dataset["type"];
}
}
});
}
window.addEventListener("click", function (e) {
for (const select of document.querySelectorAll(".custom__select")) {
if (!select.contains(e.target)) {
select.classList.remove("open");
}
}
});
#charset "UTF-8";
nav ul {
list-style-type: none;
display: flex;
flex-direction: row;
width: 100%;
justify-content: space-evenly;
}
.content {
display: flex;
flex-direction: column;
align-items: center;
}
button.clear {
border: 0;
background: #fff;
}
#selectedFilter {
color: #005fec;
}
ul {
padding-left: 0;
margin: 0;
}
.filter {
padding-right: 15px;
padding-left: 15px;
margin-bottom: 2rem;
display: flex;
flex-direction: column;
}
#media (min-width: 768px) {
.filter__settings {
display: flex;
flex-direction: row;
border-top: 1px solid #E0E5EC;
border-bottom: 1px solid #E0E5EC;
}
}
.custom__select {
position: relative;
display: flex;
flex-direction: column;
}
#media (min-width: 768px) {
.custom::before, .custom__options {
transition: all 0.2s ease-in;
}
}
.custom__select-wrapper {
position: relative;
user-select: none;
padding: 0;
border-bottom: 1px solid #E0E5EC;
}
.custom__select-wrapper:last-child {
border: 0;
}
.custom__select-wrapper.clearFilter {
display: flex;
flex-direction: column;
justify-content: center;
}
.custom__select-wrapper .selected-clearFilter {
position: relative;
user-select: none;
padding: 1rem 0 !important;
}
#media (min-width: 768px) {
.custom__select-wrapper {
padding: 0 2em;
border: 0;
display: flex;
justify-content: center;
align-items: center;
}
.custom__select-wrapper:first-child, .custom__select-wrapper:last-child {
padding: 0;
}
}
.custom__select-wrapper h6 {
padding: 20px 3px;
color: #62668C;
font-weight: 300;
}
.custom__select-trigger {
position: relative;
display: flex;
align-items: center;
justify-content: space-between;
cursor: pointer;
}
#media (min-width: 768px) {
.custom__select-trigger {
justify-content: space-evenly;
margin-right: auto;
}
}
.custom__select-wrapper h6, .custom__select-trigger h6 {
font-size: 0.75rem;
line-height: 0.75rem;
letter-spacing: 1px;
text-transform: uppercase;
padding: 20px 0;
}
.custom__select-trigger h6 {
color: #005fec;
font-weight: 900;
}
.custom__select-wrapper #selectedFilter {
font-size: 12px;
line-height: 12px;
letter-spacing: 1px;
text-transform: uppercase;
color: #005fec;
font-weight: 800;
padding: 0;
}
.custom__options {
display: none;
top: 100%;
left: 0;
right: 0;
border-top: 0;
opacity: 0;
visibility: hidden;
pointer-events: none;
z-index: 2;
color: #E0E5EC;
}
#media (min-width: 768px) {
.custom__options {
display: unset;
position: absolute;
background-color: #005fec;
max-height: 320px;
overflow-y: scroll;
}
.custom__options#storyFilter {
overflow: hidden;
}
}
.custom__options.active {
display: block;
visibility: visible;
opacity: 1;
z-index: 10;
}
.custom__select-trigger, .custom__option {
letter-spacing: 1px;
font-weight: 800;
color: #005fec;
border: 0;
background: transparent;
}
#media (min-width: 768px) {
.custom__select.open::before {
content: "";
position: absolute;
bottom: 0;
left: 11px;
border-left: 11px solid transparent;
border-right: 11px solid transparent;
border-bottom: 11px solid #005fec;
}
}
.custom__select .custom__options {
min-width: 15rem;
}
.custom__select.open .custom__options {
display: block;
opacity: 1;
visibility: visible;
pointer-events: all;
color: #fff;
min-width: 15rem;
}
#media (min-width: 768px) {
.custom__select.open .custom__options {
display: unset;
box-shadow: 0px 12px 30px rgba(0, 0, 0, 0.12);
}
}
.custom__option {
position: relative;
display: block;
padding: 0 22px 0 12px;
font-weight: 400;
color: #62668C;
cursor: pointer;
font-size: 1rem;
line-height: 1rem;
margin: 1.5rem 0;
}
#media (min-width: 768px) {
.custom__option {
font-size: 1.25rem;
line-height: 1.25rem;
color: white;
font-weight: 300;
padding: 0 22px 0 20px;
}
.custom__option a {
color: white !important;
text-decoration: none;
}
}
.custom__option:hover {
cursor: pointer;
}
.custom__option.selected {
color: #005fec;
}
#media (min-width: 768px) {
.custom__option.selected {
color: #ffffff;
}
}
.custom__option.selected::before {
content: "•";
margin-left: -12px;
padding-right: 8px;
}
.empty-state {
width: 100%;
display: flex;
background: #005fec;
padding: 1rem;
border-radius: 4px;
align-items: center;
margin: 2rem 0.5rem;
}
.empty-state h4 {
color: white;
font-size: 1rem;
line-height: 1.5rem;
font-weight: 300;
margin-left: 0.5rem;
}
.empty-state h4 span {
color: white;
text-decoration: underline;
cursor: pointer;
}
.arrow {
position: relative;
height: 5px;
width: 3px;
margin-left: 0.5rem;
margin-bottom: 0.1rem;
}
.arrow::before, .arrow::after {
content: "";
position: absolute;
bottom: 0px;
width: 0.1rem;
height: 100%;
transition: all 0.45s;
}
.arrow::before {
left: 0px;
transform: rotate(45deg);
background-color: #005fec;
}
#media (min-width: 768px) {
.arrow::before {
left: 7px;
}
}
.arrow::after {
left: -2.5px;
transform: rotate(-45deg);
background-color: #005fec;
}
#media (min-width: 768px) {
.arrow::after {
left: 4.5px;
}
}
.open .arrow::before {
left: 0px;
transform: rotate(-45deg);
}
#media (min-width: 768px) {
.open .arrow::before {
left: 7px;
}
}
.open .arrow::after {
left: -2.5px;
transform: rotate(45deg);
}
#media (min-width: 768px) {
.open .arrow::after {
left: 4.5px;
}
}
<div class="container">
<nav>
<ul>
<li>Home</li>
<li>About</li>
<li>Products</li>
<li>Sales</li>
<li>Contact</li>
</ul>
</nav>
<section class="content">
<h2 class="title">Hello World</h2>
<h6 class="subtitle">Lorem ipsum dolor sit amet.</h6>
</section>
<section class="filter">
<div class="filter__settings">
<div class="custom__select-wrapper">
<h6>filter by</h6>
</div>
<div class="custom__select-wrapper">
<div class="custom__select story-sel selector" role="menubar">
<button class="custom__select-trigger" aria-haspopup="true" aria-expanded="false" id="storySelector">
<h6>Story Type</h6>
<div class="arrow"></div>
</button>
<ul class="custom__options dropdown story-selector" id="storyFilter" aria-label="submenu" role="menu" aria-labelledby="custom-dropdown">
<li role="menuitem" class="custom__option selected" data-type="all" id="storyItem_all">All
</li>
<li role="menuitem" class="custom__option" data-type="news" id="storyItem_nm"><a href="#">News and
media</a></li>
<li role="menuitem" class="custom__option" data-type="analysis" id="storyItem_analysis">Analysis</li>
<li role="menuitem" class="custom__option" data-type="press" id="storyItem_pr"><a href="#">Press
releases</a></li>
</ul>
</div>
</div>
<div class="custom__select-wrapper">
<div class="custom__select year-sel selector">
<button type="button" class="custom__select-trigger" id="yearSelector">
<h6>Year</h6>
<div class=" arrow"></div>
</button>
<ul class="custom__options dropdown year-selector" id="yearSelection" aria-label="submenu" role="menu" aria-labelledby="custom-dropdown">
<li role="menuitem" class="custom__option selected" data-year="all">All</li>
<li role="menuitem" class="custom__option" data-year="2021">2021</li>
<li role="menuitem" class="custom__option" data-year="2020">2020</li>
<li role="menuitem" class="custom__option" data-year="2019">2019</li>
</ul>
</div>
</div>
</div>
</section>
</div>
The problem lies in your anchor tags. Specifically, setting the href attribute to # will cause the page to jump to the top.
From MDN:
You can use href="#top" or the empty fragment (href="#") to link to the top of the current page, as defined in the HTML specification.
In your case, simply remove the href attribute. If you want to preserve navigation with the keyboard, set it to "javascript:void(0)"
for (const dropdown of document.querySelectorAll(".custom__select-wrapper:not(.clearFilter)")) {
dropdown.addEventListener("click", function () {
this.querySelector(".custom__select").classList.toggle("open");
});
}
for (const option of document.querySelectorAll(".custom__option")) {
option.addEventListener("click", function () {
if (!this.classList.contains("selected")) {
this.parentNode
.querySelector(".custom__option.selected")
.classList.remove("selected");
this.classList.add("selected");
this.closest(".custom__select").querySelector(
".custom__select-trigger h6"
).textContent = this.textContent;
if (this.getAttribute("data-type")) {
current_story = this.dataset["type"];
}
}
});
}
window.addEventListener("click", function (e) {
for (const select of document.querySelectorAll(".custom__select")) {
if (!select.contains(e.target)) {
select.classList.remove("open");
}
}
});
#charset "UTF-8";
nav ul {
list-style-type: none;
display: flex;
flex-direction: row;
width: 100%;
justify-content: space-evenly;
}
.content {
display: flex;
flex-direction: column;
align-items: center;
}
button.clear {
border: 0;
background: #fff;
}
#selectedFilter {
color: #005fec;
}
ul {
padding-left: 0;
margin: 0;
}
.filter {
padding-right: 15px;
padding-left: 15px;
margin-bottom: 2rem;
display: flex;
flex-direction: column;
}
#media (min-width: 768px) {
.filter__settings {
display: flex;
flex-direction: row;
border-top: 1px solid #E0E5EC;
border-bottom: 1px solid #E0E5EC;
}
}
.custom__select {
position: relative;
display: flex;
flex-direction: column;
}
#media (min-width: 768px) {
.custom::before, .custom__options {
transition: all 0.2s ease-in;
}
}
.custom__select-wrapper {
position: relative;
user-select: none;
padding: 0;
border-bottom: 1px solid #E0E5EC;
}
.custom__select-wrapper:last-child {
border: 0;
}
.custom__select-wrapper.clearFilter {
display: flex;
flex-direction: column;
justify-content: center;
}
.custom__select-wrapper .selected-clearFilter {
position: relative;
user-select: none;
padding: 1rem 0 !important;
}
#media (min-width: 768px) {
.custom__select-wrapper {
padding: 0 2em;
border: 0;
display: flex;
justify-content: center;
align-items: center;
}
.custom__select-wrapper:first-child, .custom__select-wrapper:last-child {
padding: 0;
}
}
.custom__select-wrapper h6 {
padding: 20px 3px;
color: #62668C;
font-weight: 300;
}
.custom__select-trigger {
position: relative;
display: flex;
align-items: center;
justify-content: space-between;
cursor: pointer;
}
#media (min-width: 768px) {
.custom__select-trigger {
justify-content: space-evenly;
margin-right: auto;
}
}
.custom__select-wrapper h6, .custom__select-trigger h6 {
font-size: 0.75rem;
line-height: 0.75rem;
letter-spacing: 1px;
text-transform: uppercase;
padding: 20px 0;
}
.custom__select-trigger h6 {
color: #005fec;
font-weight: 900;
}
.custom__select-wrapper #selectedFilter {
font-size: 12px;
line-height: 12px;
letter-spacing: 1px;
text-transform: uppercase;
color: #005fec;
font-weight: 800;
padding: 0;
}
.custom__options {
display: none;
top: 100%;
left: 0;
right: 0;
border-top: 0;
opacity: 0;
visibility: hidden;
pointer-events: none;
z-index: 2;
color: #E0E5EC;
}
#media (min-width: 768px) {
.custom__options {
display: unset;
position: absolute;
background-color: #005fec;
max-height: 320px;
overflow-y: scroll;
}
.custom__options#storyFilter {
overflow: hidden;
}
}
.custom__options.active {
display: block;
visibility: visible;
opacity: 1;
z-index: 10;
}
.custom__select-trigger, .custom__option {
letter-spacing: 1px;
font-weight: 800;
color: #005fec;
border: 0;
background: transparent;
}
#media (min-width: 768px) {
.custom__select.open::before {
content: "";
position: absolute;
bottom: 0;
left: 11px;
border-left: 11px solid transparent;
border-right: 11px solid transparent;
border-bottom: 11px solid #005fec;
}
}
.custom__select .custom__options {
min-width: 15rem;
}
.custom__select.open .custom__options {
display: block;
opacity: 1;
visibility: visible;
pointer-events: all;
color: #fff;
min-width: 15rem;
}
#media (min-width: 768px) {
.custom__select.open .custom__options {
display: unset;
box-shadow: 0px 12px 30px rgba(0, 0, 0, 0.12);
}
}
.custom__option {
position: relative;
display: block;
padding: 0 22px 0 12px;
font-weight: 400;
color: #62668C;
cursor: pointer;
font-size: 1rem;
line-height: 1rem;
margin: 1.5rem 0;
}
#media (min-width: 768px) {
.custom__option {
font-size: 1.25rem;
line-height: 1.25rem;
color: white;
font-weight: 300;
padding: 0 22px 0 20px;
}
.custom__option a {
color: white !important;
text-decoration: none;
}
}
.custom__option:hover {
cursor: pointer;
}
.custom__option.selected {
color: #005fec;
}
#media (min-width: 768px) {
.custom__option.selected {
color: #ffffff;
}
}
.custom__option.selected::before {
content: "•";
margin-left: -12px;
padding-right: 8px;
}
.empty-state {
width: 100%;
display: flex;
background: #005fec;
padding: 1rem;
border-radius: 4px;
align-items: center;
margin: 2rem 0.5rem;
}
.empty-state h4 {
color: white;
font-size: 1rem;
line-height: 1.5rem;
font-weight: 300;
margin-left: 0.5rem;
}
.empty-state h4 span {
color: white;
text-decoration: underline;
cursor: pointer;
}
.arrow {
position: relative;
height: 5px;
width: 3px;
margin-left: 0.5rem;
margin-bottom: 0.1rem;
}
.arrow::before, .arrow::after {
content: "";
position: absolute;
bottom: 0px;
width: 0.1rem;
height: 100%;
transition: all 0.45s;
}
.arrow::before {
left: 0px;
transform: rotate(45deg);
background-color: #005fec;
}
#media (min-width: 768px) {
.arrow::before {
left: 7px;
}
}
.arrow::after {
left: -2.5px;
transform: rotate(-45deg);
background-color: #005fec;
}
#media (min-width: 768px) {
.arrow::after {
left: 4.5px;
}
}
.open .arrow::before {
left: 0px;
transform: rotate(-45deg);
}
#media (min-width: 768px) {
.open .arrow::before {
left: 7px;
}
}
.open .arrow::after {
left: -2.5px;
transform: rotate(45deg);
}
#media (min-width: 768px) {
.open .arrow::after {
left: 4.5px;
}
}
<div class="container">
<nav>
<ul>
<li>Home</li>
<li>About</li>
<li>Products</li>
<li>Sales</li>
<li>Contact</li>
</ul>
</nav>
<section class="content">
<h2 class="title">Hello World</h2>
<h6 class="subtitle">Lorem ipsum dolor sit amet.</h6>
</section>
<section class="filter">
<div class="filter__settings">
<div class="custom__select-wrapper">
<h6>filter by</h6>
</div>
<div class="custom__select-wrapper">
<div class="custom__select story-sel selector" role="menubar">
<button class="custom__select-trigger" aria-haspopup="true" aria-expanded="false" id="storySelector">
<h6>Story Type</h6>
<div class="arrow"></div>
</button>
<ul class="custom__options dropdown story-selector" id="storyFilter" aria-label="submenu" role="menu" aria-labelledby="custom-dropdown">
<li role="menuitem" class="custom__option selected" data-type="all" id="storyItem_all">All
</li>
<li role="menuitem" class="custom__option" data-type="news" id="storyItem_nm"><a href="javascript:void(0);">News and
media</a></li>
<li role="menuitem" class="custom__option" data-type="analysis" id="storyItem_analysis">Analysis</li>
<li role="menuitem" class="custom__option" data-type="press" id="storyItem_pr"><a href="javascript:void(0);">Press
releases</a></li>
</ul>
</div>
</div>
<div class="custom__select-wrapper">
<div class="custom__select year-sel selector">
<button type="button" class="custom__select-trigger" id="yearSelector">
<h6>Year</h6>
<div class=" arrow"></div>
</button>
<ul class="custom__options dropdown year-selector" id="yearSelection" aria-label="submenu" role="menu" aria-labelledby="custom-dropdown">
<li role="menuitem" class="custom__option selected" data-year="all">All</li>
<li role="menuitem" class="custom__option" data-year="2021">2021</li>
<li role="menuitem" class="custom__option" data-year="2020">2020</li>
<li role="menuitem" class="custom__option" data-year="2019">2019</li>
</ul>
</div>
</div>
</div>
</section>
</div>

position fixed for internet explorer

When the screen width becomes less than 767, the menu turns into a burger and on IE it looks different.
The alignment of items with flex disappears (the burger button and the basket are pressed), I sin on the menu that is positioned with
using fixed (becomes fixed at the checkpoint), I think that on IE the menu still takes its
the place, because of which the alignment occurs with its consideration. If you comment out the menu, everything will be ok.
How to fix it?
enter image description here
header in static condition
enter image description here
<div class="header_body">
<a href="#">
<h1>ze<span>bra</span></h1>
</a>
<div class="wrap-align">
<nav class="header_menu">
<ul class="header_list">
<li>Home</li>
<li>Products</li>
<li>Shopping</li>
<li>Contact</li>
</ul>
</nav>
<div class="price">
<a href="#">
<img src="img/Shape1.png" alt="">
</a>
<span>$35.00</span>
<span>▼</span>
</div>
<div class="header_burger">
<span></span>
</div>
</div>
</div>
//css
.header_body {
position: relative;
display: flex;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
justify-content: space-between;
-webkit-box-pack: justify;
-webkit-justify-content: space-between;
-ms-flex-pack: justify;
height: 86px;
align-items: center;
-webkit-box-align: center;
-webkit-align-items: center;
-ms-flex-align: center;
> a {
text-decoration: none;
color: $colorWord_header;
position: relative;
z-index: 5;
display: inline-block;
margin-right: 40px;
}
a > h1 {
font-size: 38px;
font-family: "HelveticaNeueCyr-Bold";
text-transform: uppercase;
}
a > h1 > span {
color: $logo_color;
}
}
.wrap-align {
width: 650px;
display: flex;
justify-content: space-between;
align-items: center;
}
.header_burger {
display: none;
}
.header_menu {
// margin-right: 118px;
}
.header_list {
display: flex;
position: relative;
z-index: 2;
li {
list-style: none;
}
a {
text-decoration: none;
display: inline-block;
color: $colorWord_header;
font-size: 18px;
font-family: "HelveticaNeueCyr-Regular";
padding: 34px 15px;
transition: all 0.3s;
&:hover {
color: #fff;
background-color: $bgc_head;
}
}
}
.price {
position: relative;
z-index: 5;
a {
text-decoration: none;
}
img {
vertical-align: baseline;
}
a + span {
font-size: 24px;
font-family: "HelveticaNeueCyr-Regular";
color: rgb(157, 157, 157);
margin: 0 10px;
}
span + span {
font-size: 18px;
color: rgb(157, 157, 157);
vertical-align: super;
cursor: pointer;
}
}
//#media
.header {
.header_burger {
display: block;
position: relative;
width: 30px;
height: 20px;
position: relative;
z-index: 3;
}
.header_burger:before,
.header_burger:after {
content: "";
position: absolute;
background-color: black;
width: 100%;
height: 2px;
left: 0;
transition: all 0.3s;
}
.header_burger:before {
top: 0;
}
.header_burger:after {
bottom: 0;
}
.header_burger span {
position: absolute;
top: 9px;
left: 0;
background-color: black;
width: 100%;
height: 2px;
transition: all 0.3s;
}
.header_burger.active span {
transform: scale(0);
}
.header_burger.active:before {
transform: rotate(45deg);
top: 9px;
}
.header_burger.active:after {
transform: rotate(-45deg);
bottom: 9px;
}
.header_menu {
position: fixed;
top: -100%;
left: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(255, 255, 255, 0.941);
padding: 130px 0 0 0;
transition: all 0.4s;
z-index: 1;
}
.wrap-align {
width: 300px;
}
.header_menu.active {
top: 0;
}
.header_list {
margin: 0 0 0 20px;
display: block;
li {
// margin: 10px 0;
}
a {
padding: 10px 20px;
}
}
.price {
margin-right: -30%;
}
}

not able to align in same row

I was not able to align in same horizontal line both the content. I was using flex. How to align both the navigation menu and another flex content?
const navButton = document.querySelector('button[aria-expanded]');
function toggleNav({
target
}) {
const expanded = target.getAttribute('aria-expanded') === 'true' || false;
navButton.setAttribute('aria-expanded', !expanded);
}
navButton.addEventListener('click', toggleNav);
* {
box-sizing: border-box;
margin: 0;
padding: 0;
overflow: hidden;
font-family: 'Roboto', sans-serif;
}
.wrap {
width: 100%;
margin: 0 auto;
}
[aria-controls="menu-list"] {
display: none;
}
.menu ul {
list-style: none;
display: flex;
justify-content: space-between;
width: 90%;
margin: 20px auto;
}
.menu ul li {
flex-grow: 1;
flex-basis: 1px;
padding: 10px;
}
.menu ul li a {
display: block;
text-align: center;
text-decoration: none;
font-size: 20px;
font-weight: 700;
background: #ffc600;
padding: 10px;
color: black;
}
.main {
width: 100%;
}
.cat1 {
margin-right: 20px;
flex: 6;
background: url(https://jolly-kalam-23776e.netlify.com/restaurantwebsite/images/taco.jpg);
height: 400px;
z-index: -1;
}
.c1title {
z-index: 1;
color: black;
background: #ffc600;
position: absolute;
top: 130px;
left: 130px;
font-size: 30px;
padding: 5px;
font-weight: 600;
}
.c1para {
z-index: 1;
color: black;
background: #ffc600;
position: absolute;
top: 250px;
left: 130px;
font-size: 16px;
padding: 5px;
font-weight: 600;
}
.cat {
flex: 2;
display: flex;
flex-direction: column;
margin-right: 20px;
}
.cat2 {
flex: 1;
background: #ffc600;
margin-bottom: 25px;
display: flex;
}
.c2title {
font-size: 30px;
font-weight: 600;
text-align: center;
margin: auto;
}
.small {
display: block;
font-size: 16px;
font-weight: 600;
}
.cat3 {
flex: 1;
background: #ffc600;
display: flex;
}
.c3title {
font-size: 30px;
font-weight: 600;
text-align: center;
margin: auto;
}
#media (min-width: 900px) {
.hero {
width: 90%;
display: flex;
margin: 0 auto;
}
}
#media (max-width: 1000px) {
.menu {
perspective: 800px;
}
[aria-controls="menu-list"] {
display: block;
margin-bottom: 10px;
}
.menu ul {
max-height: 0;
overflow: hidden;
transform: rotateX(90deg);
transition: all 0.5s;
}
[aria-expanded="true"]~ul {
display: grid;
max-height: 500px;
transform: rotateX(0);
}
[aria-expanded="false"] .close {
display: none;
}
[aria-expanded="true"] .close {
display: inline-block;
}
[aria-expanded="true"] .open {
display: none;
}
}
<link href="https://fonts.googleapis.com/css?family=Roboto&display=swap" rel="stylesheet">
<div class="wrap">
<nav class="menu">
<button aria-expanded="false" aria-controls="menu-list">
<span class="open">☰</span>
<span class="close">×</span>
Menu
</button>
<ul id="menu-list">
<li>Tacos</li>
<li>Beers</li>
<li>Wines</li>
<li>Deserts</li>
<li>Reservations</li>
</ul>
</nav>
</div>
<div class="main">
<div class="hero">
<div class="cat1">
<h6 class="c1title">Terry's Taco Joint</h6>
<p class="c1para">Pretty Good Tacos!</p>
</div>
<div class="cat">
<div class="cat2">
<p class="c2title">1.99$<br><span class="small">
Tacos</span></p>
</div>
<div class="cat3">
<p class="c3title">3.99$
<br><span class="small">Kombucha</span></p>
</div>
</div>
</div>
</div>
Image what was trying to align:
You are setting display: grid to [aria-expanded="true"] ~ ul. Remove it and it will work fine.
*{
box-sizing: border-box;
margin: 0;
padding: 0;
overflow: hidden;
font-family: 'Roboto', sans-serif;
}
.wrap{
width: 100%;
margin: 0 auto;
}
[aria-controls="menu-list"] {
display: none;
}
.menu ul{
list-style: none;
display: flex;
flex-flow: column no-wrap;
justify-content: space-between;
width: 90%;
margin: 20px auto;
}
.menu ul li{
flex-grow: 1;
flex-basis: 1px;
padding: 10px;
}
.menu ul li a{
display: block;
text-align: center;
text-decoration: none;
font-size: 20px;
font-weight: 700;
background: #ffc600;
padding: 10px;
color: black;
}
.main{
width: 100%;
}
.cat1{
margin-right: 20px;
flex: 6;
background: url(https://jolly-kalam-23776e.netlify.com/restaurantwebsite/images/taco.jpg);
height: 400px;
z-index: -1;
}
.c1title{
z-index: 1;
color:black;
background: #ffc600;
position: absolute;
top: 130px;
left: 130px;
font-size: 30px;
padding: 5px;
font-weight: 600;
}
.c1para{
z-index: 1;
color:black;
background: #ffc600;
position: absolute;
top: 250px;
left: 130px;
font-size: 16px;
padding: 5px;
font-weight: 600;
}
.cat{
flex: 2;
display: flex;
flex-direction: column;
margin-right: 20px;
}
.cat2{
flex: 1;
background: #ffc600;
margin-bottom: 25px;
display: flex;
}
.c2title{
font-size: 30px;
font-weight: 600;
text-align: center;
margin: auto;
}
.small{
display: block;
font-size: 16px;
font-weight: 600;
}
.cat3{
flex:1;
background: #ffc600;
display: flex;
}
.c3title{
font-size: 30px;
font-weight: 600;
text-align: center;
margin: auto;
}
#media (min-width: 900px){
.hero{
width: 90%;
display: flex;
margin: 0 auto;
}
}
#media (max-width: 1000px) {
.menu {
perspective: 800px;
}
[aria-controls="menu-list"] {
display: block;
margin-bottom: 10px;
}
.menu ul {
max-height: 0;
overflow: hidden;
transform: rotateX(90deg);
transition: all 0.5s;
}
[aria-expanded="true"] ~ ul {
max-height: 500px;
transform: rotateX(0);
}
[aria-expanded="false"] .close {
display: none;
}
[aria-expanded="true"] .close {
display: inline-block;
}
[aria-expanded="true"] .open {
display: none;
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="style.css">
<link href="https://fonts.googleapis.com/css?family=Roboto&display=swap" rel="stylesheet">
<title>Restaurant Wesbite</title>
</head>
<body>
<div class="wrap">
<nav class="menu">
<button aria-expanded="false" aria-controls="menu-list">
<span class="open">☰</span>
<span class="close">×</span>
Menu
</button>
<ul id="menu-list">
<li>Tacos</li>
<li>Beers</li>
<li>Wines</li>
<li>Deserts</li>
<li>Reservations</li>
</ul>
</nav>
</div>
<div class="main">
<div class="hero">
<div class="cat1">
<h6 class="c1title">Terry's Taco Joint</h6>
<p class="c1para">Pretty Good Tacos!</p>
</div>
<div class="cat">
<div class="cat2">
<p class="c2title">1.99$<br><span class="small">
Tacos</span></p>
</div>
<div class="cat3">
<p class="c3title">3.99$
<br><span class="small">Kombucha</span></p>
</div>
</div>
</div>
</div>
<script>
const navButton = document.querySelector('button[aria-expanded]');
function toggleNav({ target }) {
const expanded = target.getAttribute('aria-expanded') === 'true' || false;
navButton.setAttribute('aria-expanded', !expanded);
}
navButton.addEventListener('click', toggleNav);
</script>
</body>
</html>
I have added this tiny code snippet to achieve what your desired image conveyed. Basically CSS flexbox works in direct parent-children relationship and flex assigned to parent only works for direct children and not children of children elements.
.menu #menu-list{display: flex;}
const navButton = document.querySelector('button[aria-expanded]');
function toggleNav({
target
}) {
const expanded = target.getAttribute('aria-expanded') === 'true' || false;
navButton.setAttribute('aria-expanded', !expanded);
}
navButton.addEventListener('click', toggleNav);
* {
box-sizing: border-box;
margin: 0;
padding: 0;
overflow: hidden;
font-family: 'Roboto', sans-serif;
}
.wrap {
width: 100%;
margin: 0 auto;
}
[aria-controls="menu-list"] {
display: none;
}
.menu ul {
list-style: none;
display: flex;
justify-content: space-between;
width: 90%;
margin: 20px auto;
}
.menu ul li {
flex-grow: 1;
flex-basis: 1px;
padding: 10px;
}
.menu ul li a {
display: block;
text-align: center;
text-decoration: none;
font-size: 20px;
font-weight: 700;
background: #ffc600;
padding: 10px;
color: black;
}
.menu #menu-list{
display: flex;}
.main {
width: 100%;
}
.cat1 {
margin-right: 20px;
flex: 6;
background: url(https://jolly-kalam-23776e.netlify.com/restaurantwebsite/images/taco.jpg);
height: 400px;
z-index: -1;
}
.c1title {
z-index: 1;
color: black;
background: #ffc600;
position: absolute;
top: 130px;
left: 130px;
font-size: 30px;
padding: 5px;
font-weight: 600;
}
.c1para {
z-index: 1;
color: black;
background: #ffc600;
position: absolute;
top: 250px;
left: 130px;
font-size: 16px;
padding: 5px;
font-weight: 600;
}
.cat {
flex: 2;
display: flex;
flex-direction: column;
margin-right: 20px;
}
.cat2 {
flex: 1;
background: #ffc600;
margin-bottom: 25px;
display: flex;
}
.c2title {
font-size: 30px;
font-weight: 600;
text-align: center;
margin: auto;
}
.small {
display: block;
font-size: 16px;
font-weight: 600;
}
.cat3 {
flex: 1;
background: #ffc600;
display: flex;
}
.c3title {
font-size: 30px;
font-weight: 600;
text-align: center;
margin: auto;
}
#media (min-width: 900px) {
.hero {
width: 90%;
display: flex;
margin: 0 auto;
}
}
#media (max-width: 1000px) {
.menu {
perspective: 800px;
}
[aria-controls="menu-list"] {
display: block;
margin-bottom: 10px;
}
.menu ul {
max-height: 0;
overflow: hidden;
transform: rotateX(90deg);
transition: all 0.5s;
}
[aria-expanded="true"]~ul {
display: grid;
max-height: 500px;
transform: rotateX(0);
}
[aria-expanded="false"] .close {
display: none;
}
[aria-expanded="true"] .close {
display: inline-block;
}
[aria-expanded="true"] .open {
display: none;
}
}
<link href="https://fonts.googleapis.com/css?family=Roboto&display=swap" rel="stylesheet">
<div class="wrap">
<nav class="menu">
<button aria-expanded="false" aria-controls="menu-list">
<span class="open">☰</span>
<span class="close">×</span>
Menu
</button>
<ul id="menu-list">
<li>Tacos</li>
<li>Beers</li>
<li>Wines</li>
<li>Deserts</li>
<li>Reservations</li>
</ul>
</nav>
</div>
<div class="main">
<div class="hero">
<div class="cat1">
<h6 class="c1title">Terry's Taco Joint</h6>
<p class="c1para">Pretty Good Tacos!</p>
</div>
<div class="cat">
<div class="cat2">
<p class="c2title">1.99$<br><span class="small">
Tacos</span></p>
</div>
<div class="cat3">
<p class="c3title">3.99$
<br><span class="small">Kombucha</span></p>
</div>
</div>
</div>
</div>

Navbar height on scroll

I am creating a simple navigation in angular 6, am using bem methodology and flexbox for css.
Here is the navigation markup:
<div class="main-header">
<nav class="main-nav" ng-sticky [offSet]="0" [addClass]="'main-sticky'" appMainNav #ref="appMainNav">
<div class="main-nav__logo " ng-sticky [offSet]="0" [addClass]="'main-sticky__logo'">
<img class="man-nav__logo-green" src="/assets/images/logo-white.png">
</div>
<div class="main-nav__toggle">
<i class="main-nav__bars fa fa-bars" ng-sticky [offSet]="0" [addClass]="'main-bars'"></i>
</div>
<ul class="main-nav__list " ng-sticky [addClass]="'main-sticky-link'" [ngClass]="ref.click === true? 'Navbar__ToggleShow' :''">
<li class="main-nav__item">
<a class="main-nav__link" href="#">Home</a>
</li>
<li class="main-nav__item">
<a class="main-nav__link" href="#">About us</a>
</li>
<li class="main-nav__item">
<a class="main-nav__link" href="#">What we do</a>
</li>
<li class="main-nav__item">
<a class="main-nav__link " href="#">Projects</a>
</li>
<li class="main-nav__item">
<a class="main-nav__link " href="#">Contact</a>
</li>
</ul>
</nav>
<div class="main-banner">
<h2>We are a team of
<strong>experts</strong>.</h2>
<p>Founded in 2014, the BDTS Poland specializes in IT personnel outsourcing for the areas of banking, insurance, telecommunications,
high-tech, pharmacy, logistics and many others</p>
<a href="http://en.astek.pl/about-us/" class="main-banner__green-button main-banner__arrow-right">Read more
<i></i>
</a>
</div>
</div>
Here is the mobile CSS for navbar:
#media only screen and(max-width: 768px) {
.main-nav {
margin: 0;
display: block;
position: inherit;
height: auto;
overflow: auto;
background: white;
}
.main-nav__list {
margin-top: 20px;
display: none;
flex-direction: column;
justify-content: center;
align-items: center;
}
.main-nav__item:after {
content: '';
width: 1px;
}
.Navbar__ToggleShow {
display: flex;
}
.main-nav__logo {
position: relative;
bottom: 49px;
background-repeat: no-repeat;
background-image: url("/assets/images/logo-green.png");
}
.man-nav__logo-green {
visibility: hidden !important;
}
.main-nav__bars {
display: flex;
justify-content: flex-end;
cursor: pointer;
padding: 26px;
font-size: 50px;
color: #00964e;
top: 0;
margin-top: -196px;
}
.main-nav__link {
color: #444;
}
}
In desktop version everything works fine: but in mobile version navbar increase its height on scroll and hamburger menu disappears,
Here is the solution I tried: (removing height in .man-nav)
.main-nav {
margin: 0;
display: block;
position: inherit;
overflow: auto;
background: white;
}
Now navbar height does not increase on scroll but hamburger menu disappear.
UPDATE - Here is the full CSS for navbar component:
#charset "UTF-8";
#font-face {
font-family: "icomoon";
src: url("/assets/fonts/icomoon.ttf");
}
.main-header {
width: 100%;
float: left;
display: block;
min-height: 100vh;
height: 100%;
background-size: cover;
background-position: center;
padding-bottom: 100px;
background-image: url("/assets/images/banner.jpg");
}
.main-sticky {
background-color: white;
height: 100px;
}
.main-sticky__logo {
position: relative !important;
background-repeat: no-repeat;
background-image: url("/assets/images/logo-green.png");
}
.main-sticky-link .main-nav__link {
color: #444 !important;
}
.main-nav {
position: sticky;
align-items: center;
justify-content: space-around;
left: 0;
display: flex;
z-index: 2;
width: 100%;
}
.main-nav__logo {
position: relative;
}
.main-nav__bars {
color: white;
}
.main-nav__list {
list-style: none;
display: flex;
color: white;
position: relative !important;
}
.main-nav__item {
padding: 24px 27px;
position: relative;
}
.main-nav__item:after {
-webkit-transition: all 0.15s ease-in-out;
transition: all 0.15s ease-in-out;
content: "";
display: block;
float: left;
background-color: #f5f5f5;
width: 2px;
height: 60px;
-webkit-transform: rotate(20deg);
transform: skew(155deg);
position: absolute;
right: 0;
bottom: 6px;
}
.main-nav__item:last-child::after {
content: "";
width: 0px;
}
.main-nav__item:hover::after {
width: calc(100% + 1px);
}
.main-nav__item:hover .main-nav__link {
color: #444;
position: relative;
z-index: 3;
}
.main-nav__link {
list-style: none;
font-size: 1rem;
color: white;
font-family: "proxima-nova-n6", "proxima-nova";
font-style: normal;
font-weight: 600;
}
.main-nav__bars {
display: none;
}
.main-banner {
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
}
.main-banner h2 {
font-size: 3.75rem;
line-height: 5.375rem;
margin-bottom: 1.5rem;
color: #fff;
font-family: "proxima-nova-n4", "proxima-nova";
font-style: normal;
font-weight: 400;
margin-top: 70px;
font-weight: normal;
}
.main-banner p {
font-size: 1.25rem;
font-weight: normal;
color: white;
text-align: center;
max-width: 700px;
margin-bottom: 3.375rem;
margin-right: auto;
margin-left: auto;
}
.main-banner__green-button {
height: 3.4375rem;
background-color: #00964e;
text-decoration: none;
color: #fff;
padding: 11px 13px;
display: inline-block;
box-sizing: border-box;
line-height: 27px;
border-radius: 30px;
border: 3px solid #00964e;
font-size: 1.125rem;
padding-right: 50px;
font-family: "proxima-nova-n6", "proxima-nova";
font-style: normal;
font-weight: 600;
position: relative;
-webkit-transition: all 0.15s ease-in-out;
transition: all 0.15s ease-in-out;
}
.main-banner__arrow-right::after {
font-family: "icomoon";
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
content: "" !important;
font-size: 33px;
}
.main-banner__green-button::after {
float: right;
content: "";
display: block;
width: 34px;
height: 34px;
margin-left: 10px;
top: 10px;
position: absolute;
right: 10px;
}
.main-banner__green-button:hover {
background-color: white;
color: green;
}
.main-banner__arrow-down {
transform: rotate(90deg);
width: 34px;
height: 34px;
position: absolute;
bottom: 176px;
margin-left: -17px;
left: 50%;
z-index: 2;
-webkit-transition: all 0.15s ease-in-out;
transition: all 0.15s ease-in-out;
background-image: url("/assets/images/icon-arrow-right.png");
}
#main-sticky {
background-color: white;
}
#media only screen and (max-width: 768px) {
.main-nav {
margin: 0;
display: block;
position: inherit;
height: auto;
overflow: auto;
background: white;
}
.main-nav__list {
margin-top: 20px;
display: none;
flex-direction: column;
justify-content: center;
align-items: center;
}
.main-nav__item:after {
content: "";
width: 1px;
}
.Navbar__ToggleShow {
display: flex;
}
.main-nav__logo {
position: relative;
bottom: 49px;
background-repeat: no-repeat;
background-image: url("/assets/images/logo-green.png");
}
.man-nav__logo-green {
visibility: hidden !important;
}
.main-nav__bars {
display: flex;
justify-content: flex-end;
cursor: pointer;
padding: 26px;
font-size: 50px;
color: #00964e;
/* position: absolute; */
top: 0;
/* bottom: 36px; */
/* right: 28px; */
margin-top: -196px;
}
.main-nav__link {
color: #444;
}
.main-banner__arrow-down {
display: block !important;
position: initial;
margin: 0 auto;
margin-top: 50px;
}
.main-banner h2 {
text-align: center;
}
}
Here is a link to the live demo
Here is GitHub repo if interested
What is wrong with my code? please help, any suggestions will be appreciated, thanks.
There is a lot to debug, here is what I spotted:
nav bar (.main-nav):
First of all, you got a script (index.js) that sets main-nav, main-nav__bars and main-nav__list position to fixed on scroll. You don't need to do that for all three components. Just set main-nav and let the children inherit.
Next you're better off changing height: auto to min-height: 125px (enough to fit the logo)
Then you need to set the nav .main-nav) overflow-x: hidden to eliminate the scrollbar on the right when overflow bugs occur.
Or better yet, make your logo itself and it's container (.main-nav__logo) have a fixed height that matches (height: 125px) and let the logo height: inherit. (you will need to crop your image for that to look nice. See reason on next section)
You're also overriding the display: flex to block with your media query. Remove that so you will be able to use the flex properties. Afterwards you can do something like: (append into your mobile media query)
.main-nav {
flex-direction: row;
flex-wrap: wrap;
justify-content: flex-start;
align-content: stretch;
align-items: stretch;
}
.main-nav__logo {
flex: 2 1 60%;
}
.main-nav__toggle {
flex: 2 1 30%;
}
.main-nav__list {
flex: 0 1 100%;
}
This should give you a result like this:
|-----------------------|----------|
| Logo | Bars |
|-----------------------|----------|
| |
| Nav ul |
| |
|----------------------------------|
Logo (.man-nav__logo-green):
Next your logo is 200x200 with lots of transparent margin, fix your logo by cropping it down using Photoshop or something to element the fixed margin. This will let your logo to fit in without overflowing the nav bar. (and more flexible in regards to margin styling)
a dirty solution is to change the logo's container to (.main-nav__logo) height: 160px and add a margin-top: -35px.
Hopefully that should make your life a bit easier. Regards.