Flexbox Footer Wrap Not Expanding - css

I am trying to set up my flexbox for responsiveness and accessibility. However as can be seen in the attached images, for some reason text is lost when reducing screen size.
Image of webpage at full size
Image of reduced size & clashing elements
/* Footer Styling Definitions */
footer {
display: flex;
flex-direction: row;
margin-top: 0px;
text-align: center;
background-color: black;
color: aliceblue;
}
#footer_left {
flex: 1;
padding-left: 5px;
}
#footer_centre {
flex: 1;
padding-left: 5px;
}
#footer_right {
flex: 1;
padding-left: 5px;
position: relative;
}
.logo_footer {
padding-top: 10px;
padding-bottom: 10px;
}
.legal {
margin: 0;
padding-top: 5px;
position: absolute;
top: 90%;
left: 50%;
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
.legal_stuff {
text-decoration: none;
color: white;
}
.privacy_policy {
text-decoration: none;
color: white;
}
.privacy_policy:hover {
font-weight: bold;
}
.legal_stuff:hover {
font-weight: bold;
}
#media screen and (max-width: 1024px) {
section {
width: 100%;
}
}
#media screen and (max-width: 800px) {
nav {
width: 100%;
}
section {
flex-direction: column;
}
aside {
display: none;
}
nav ul {
flex-direction: column;
}
form {
margin: 0 auto;
flex-direction: column;
}
.label {
text-align: left;
}
footer {
flex-direction: column;
}
}
I would love some assistance - sorry I am just new to web development so I am trying to learn as much as I can.

I think it can help you.
This is my screenshot image.
#charset "UTF-8";
/* CSS Document */
#import url('https://fonts.googleapis.com/css2?family=Baloo+2&family=Comfortaa&family=Shadows+Into+Light&display=swap');
body {
font-size: 100%;
line-height: 1.5;
margin: 0;
padding: 0;
font-family: 'Baloo 2', cursive;
/*font-family: 'Comfortaa', cursive;*/
height: 100vh;
}
p {
margin: auto;
text-align: center;
}
img {
display: block;
margin-left: auto;
margin-right: auto;
}
h1 {
}
h2 {
text-align: center;
font-size: 2em;
margin-bottom: auto;
margin-top: auto;
}
/* Navigation Styling Definitions */
nav {
width: 100%;
top: 0;
position: fixed;
background-color: rgba(255,255,255,0.70);
z-index: 101;
}
nav ul {
display: flex;
}
nav li {
flex: 1;
display: inline;
list-style-type: none;
text-align: center;
}
nav a {
text-decoration: none;
color: black;
}
nav a:hover {
text-decoration: overline underline;
color: darkslategray;
}
/* Header Styling Definitions */
header {
background-image: url("images/sunset-1645103.jpeg");
position: relative;
width: 100%;
height: 200px;
background-position: center;
margin-top: 55px;
}
.logo_header {
margin: 0;
position: absolute;
top: 50%;
left: 50%;
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
/* Section Styling Definitions */
section {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
width: 100%;
margin: 0 auto;
}
.phone {
text-decoration: none;
color: black;
}
.phone:hover {
color: darkslategray;
}
.call_img {
width: 40px;
height: 40px;
padding-bottom: -10px;
}
/* Aside Styling Definitions */
aside {
flex: 1;
background-color: blue;
}
/* Article Styling Definitions */
article {
display: flex;
flex: 3;
background-color: transparent;
}
#article_left {
flex: 1;
align-content: center;
margin-right: auto;
background-color: aqua;
}
#article_right {
flex: 1;
align-content: center;
justify-content: center;
padding-bottom: 5px;
background-color: transparent;
margin-left: auto;
}
.cta {
flex: 30;
border: 1px solid black;
border-radius: 5px;
margin: 25px;
padding-left: 5px;
}
form {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
align-items: center;
margin: 0 auto;
width: 80%;
}
.input-box {
padding-right: 5px;
display: flex;
width: 100%;
margin-bottom: 10px;
}
label {
width: 45%;
padding-right: 5px;
text-align: right;
}
input, textarea {
width: 150%;
}
/* Footer Styling Definitions */
footer {
display: flex;
flex-direction: row;
margin-top: 0px;
text-align: center;
background-color: black;
color: aliceblue;
}
#footer_left {
flex: 1;
padding-left: 5px;
}
#footer_centre {
flex: 1;
padding-left: 5px;
}
#footer_right {
flex: 1;
padding-left: 5px;
position: relative;
display: flex;
justify-content: center;
align-items: flex-end;
}
.logo_footer {
padding-top: 10px;
padding-bottom: 10px;
}
.legal {
margin: 0;
padding-top: 5px;
}
.legal_stuff {
text-decoration: none;
color: white;
}
.privacy_policy {
text-decoration: none;
color: white;
}
.privacy_policy:hover {
font-weight: bold;
}
.legal_stuff:hover {
font-weight: bold;
}
#media screen and (max-width: 1024px) {
section {
width: 100%;
}
}
#media screen and (max-width: 800px) {
nav {
width: 100%;
}
section {
flex-direction: column;
}
aside {
display: none;
}
nav ul {
flex-direction: column;
}
form {
margin: 0 auto;
flex-direction: column;
}
.label {
text-align: left;
}
footer {
flex-direction: column;
}
}
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="css/style.css" text="text/css">
<title>Summer Escapes | Contact Us</title>
</head>
<body>
<!-- Main Navigation -->
<nav>
<ul>
<lI>Home</lI>
<lI>Reviews</lI>
<lI>Feedback</lI>
<lI>Contact Us</lI>
</ul>
</nav>
<!-- End Main Naigation -->
<!-- Page Header -->
<header>
<img class="logo_header" src="images/sunset_escapes_logo.png" alt="Summer Escapes Logo" height="auto">
</header>
<!-- End Page Header -->
<!-- Main Content -->
<section>
<article>
<div id="article_left">
<h2>Call Us!</h2>
<img class="call_img" src="images/phone-icon-925.png">
<h3>
<p>Want to speak to a human regarding our Summer Escapes reviews?</p>
<p>Maybe you have a review request?</p>
<p>Call us now!</p>
<p><a class="phone" href="tel:+61 412 345 678">+61 123 456 789</a></p>
</h3>
</div>
<div id="article_right">
<h2>Contact Us!</h2>
<form id="contact_form">
<div class="input-box">
<label for="contact_name">Full name:</label>
<input type="text" id="contact_name" name="contact_name" placeholder="Name">
</div>
<div class="input-box">
<label for="contact_phone">Mobile number:</label>
<input type="tel" id="contact_phone" name="contact_phone" placeholder="Mobile number">
</div>
<div class="input-box">
<label for="contact_email">Email address:</label>
<input type="email" id="contact_email" name="contact_email" placeholder="E-mail address">
</div>
<div class="input-box">
<label for="contact_message">Message:</label>
<textarea rows="4" cols="40" id="contact_message" name="contact+message" style="resize: none"></textarea>
</div>
<div class="button">
<button type="submit">Submit</button>
</div>
</form>
</div>
</article>
</section>
<!-- End Main Content -->
<!-- Footer -->
<footer>
<div id="footer_left">
<p>Socials</p>
</div>
<div id="footer_centre">
<img class="logo_footer" src="images/sunset_escapes_logo_inverted.png" alt="Summer Escapes Logo">
<p>Copyright © 2021 Summer Escapes</p>
</div>
<div id="footer_right">
<div class="legal">
<a class="legal_stuff" href="#" target="new">Legal Stuff</a> | <a class="privacy_policy" href="#" target="new">Privacy Policy</a>
</div>
</div>
</footer>
<!-- End Footer -->
</body>
</html>

#charset "UTF-8";
/* CSS Document */
#import url('https://fonts.googleapis.com/css2?family=Baloo+2&family=Comfortaa&family=Shadows+Into+Light&display=swap');
body {
font-size: 100%;
line-height: 1.5;
margin: 0;
padding: 0;
font-family: 'Baloo 2', cursive;
/*font-family: 'Comfortaa', cursive;*/
height: 100vh;
}
p {
margin: auto;
text-align: center;
}
img {
display: block;
margin-left: auto;
margin-right: auto;
}
h1 {
}
h2 {
text-align: center;
font-size: 2em;
margin-bottom: auto;
margin-top: auto;
}
/* Navigation Styling Definitions */
nav {
width: 100%;
top: 0;
position: fixed;
background-color: rgba(255,255,255,0.70);
z-index: 101;
}
nav ul {
display: flex;
}
nav li {
flex: 1;
display: inline;
list-style-type: none;
text-align: center;
}
nav a {
text-decoration: none;
color: black;
}
nav a:hover {
text-decoration: overline underline;
color: darkslategray;
}
/* Header Styling Definitions */
header {
background-image: url("images/sunset-1645103.jpeg");
position: relative;
width: 100%;
height: 200px;
background-position: center;
margin-top: 55px;
}
.logo_header {
margin: 0;
position: absolute;
top: 50%;
left: 50%;
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
/* Section Styling Definitions */
section {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
width: 100%;
margin: 0 auto;
}
.phone {
text-decoration: none;
color: black;
}
.phone:hover {
color: darkslategray;
}
.call_img {
width: 40px;
height: 40px;
padding-bottom: -10px;
}
/* Aside Styling Definitions */
aside {
flex: 1;
background-color: blue;
}
/* Article Styling Definitions */
article {
display: flex;
flex: 3;
background-color: transparent;
}
#article_left {
flex: 1;
align-content: center;
margin-right: auto;
background-color: aqua;
}
#article_right {
flex: 1;
align-content: center;
justify-content: center;
padding-bottom: 5px;
background-color: transparent;
margin-left: auto;
}
.cta {
flex: 30;
border: 1px solid black;
border-radius: 5px;
margin: 25px;
padding-left: 5px;
}
form {
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
align-items: center;
margin: 0 auto;
width: 80%;
}
.input-box {
padding-right: 5px;
display: flex;
width: 100%;
margin-bottom: 10px;
}
label {
width: 45%;
padding-right: 5px;
text-align: right;
}
input, textarea {
width: 150%;
}
/* Footer Styling Definitions */
footer {
display: flex;
flex-direction: row;
margin-top: 0px;
text-align: center;
background-color: black;
color: aliceblue;
}
#footer_left {
flex: 1;
padding-left: 5px;
}
#footer_centre {
flex: 1;
padding-left: 5px;
}
#footer_right {
flex: 1;
padding-left: 5px;
position: relative;
}
.logo_footer {
padding-top: 10px;
padding-bottom: 10px;
}
.legal {
margin: 0;
padding-top: 5px;
position: absolute;
top: 90%;
left: 50%;
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
.legal_stuff {
text-decoration: none;
color: white;
}
.privacy_policy {
text-decoration: none;
color: white;
}
.privacy_policy:hover {
font-weight: bold;
}
.legal_stuff:hover {
font-weight: bold;
}
#media screen and (max-width: 1024px) {
section {
width: 100%;
}
}
#media screen and (max-width: 800px) {
nav {
width: 100%;
}
section {
flex-direction: column;
}
aside {
display: none;
}
nav ul {
flex-direction: column;
}
form {
margin: 0 auto;
flex-direction: column;
}
.label {
text-align: left;
}
footer {
flex-direction: column;
}
}
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="css/style.css" text="text/css">
<title>Summer Escapes | Contact Us</title>
</head>
<body>
<!-- Main Navigation -->
<nav>
<ul>
<lI>Home</lI>
<lI>Reviews</lI>
<lI>Feedback</lI>
<lI>Contact Us</lI>
</ul>
</nav>
<!-- End Main Naigation -->
<!-- Page Header -->
<header>
<img class="logo_header" src="images/sunset_escapes_logo.png" alt="Summer Escapes Logo" height="auto">
</header>
<!-- End Page Header -->
<!-- Main Content -->
<section>
<article>
<div id="article_left">
<h2>Call Us!</h2>
<img class="call_img" src="images/phone-icon-925.png">
<h3>
<p>Want to speak to a human regarding our Summer Escapes reviews?</p>
<p>Maybe you have a review request?</p>
<p>Call us now!</p>
<p><a class="phone" href="tel:+61 412 345 678">+61 123 456 789</a></p>
</h3>
</div>
<div id="article_right">
<h2>Contact Us!</h2>
<form id="contact_form">
<div class="input-box">
<label for="contact_name">Full name:</label>
<input type="text" id="contact_name" name="contact_name" placeholder="Name">
</div>
<div class="input-box">
<label for="contact_phone">Mobile number:</label>
<input type="tel" id="contact_phone" name="contact_phone" placeholder="Mobile number">
</div>
<div class="input-box">
<label for="contact_email">Email address:</label>
<input type="email" id="contact_email" name="contact_email" placeholder="E-mail address">
</div>
<div class="input-box">
<label for="contact_message">Message:</label>
<textarea rows="4" cols="40" id="contact_message" name="contact+message" style="resize: none"></textarea>
</div>
<div class="button">
<button type="submit">Submit</button>
</div>
</form>
</div>
</article>
</section>
<!-- End Main Content -->
<!-- Footer -->
<footer>
<div id="footer_left">
<p>Socials</p>
</div>
<div id="footer_centre">
<img class="logo_footer" src="images/sunset_escapes_logo_inverted.png" alt="Summer Escapes Logo">
<p>Copyright © 2021 Summer Escapes</p>
</div>
<div id="footer_right">
<div class="legal">
<a class="legal_stuff" href="#" target="new">Legal Stuff</a> | <a class="privacy_policy" href="#" target="new">Privacy Policy</a>
</div>
</div>
</footer>
<!-- End Footer -->
</body>
</html>

Related

White space on the right side of the page below 400px device screen width. How to make it disappear?

I have two big problems:
The first trouble I have encountered is that when I am testing the responsivity of my website in the contact section I always meet a reappearing problem: There is a white space (.2 rem - 1.2rem width) on the right side of the body when I try to display the whole page under 400px width device.
My second problem is that I have social media icons in the footer. They appear properly in all other sections (multipage website), but only here does something prevent them to be displayed properly. I tried resizing their main divs to 100% width and 100% max-width, but an element is probably still longer than the others, which should obviously cause this kind of problem.
So about the white blank area, I think it is important to know that I have a specially styled scrollbar, which might also cause this little mischief. I am unsure, so I have also tried removing it, but it did not help. In the beginning, I also encountered the same problem with the footer, but somehow I managed to get by and was able to solve it by correcting the width of the .footer-container. Since then the white space appeared and my second problem with social media icons not being displayed properly just arose.
Here is my code:
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="contacts.css">
<title>Eckert Művek Galéria</title>
</head>
<body>
<div class="floating-btn show-btn" aria-label="up button" role="button">
<img src="assets/svg_files/chevron-up-solid.svg" alt="up img" />
</div>
<header>
<!--NAVBAR-->
<nav>
<ul class="menu" id="desktop-menu">
<li class="nav-item">Főoldal</li>
<li class="nav-item">Rólunk</li>
<li class="nav-item">Szolgáltatások</li>
<li class="nav-item">Miért mi?</li>
<li class="nav-item">Galéria</li>
<li class="nav-item">Kapcsolat</li>
</ul>
<!--HAMBURGER ICON-->
<div class="header-right-gap">
<button class="hamburger" aria-label="hamburger button">
<div class="line line-1"></div>
<div class="line line-2"></div>
<div class="line line-3"></div>
</button>
</div>
</nav>
<!--MOBILE MENU-->
<div class="mobile-menu">
<ul class="m-menu">
<li class="nav-item">Főoldal</li>
<li class="nav-item">Rólunk</li>
<li class="nav-item">Szolgáltatások</li>
<li class="nav-item">Miért mi?</li>
<li class="nav-item">Galéria</li>
<li class="nav-item">Kapcsolat</li>
</ul>
</div>
</header>
<main>
<!--CONTACT FORM-->
<div class="container">
<form>
<h1>Kapcsolat</h1>
<input type="text" id="firstName" placeholder="Családnév" required>
<input type="text" id="lastName" placeholder="Keresztnév" required>
<input type="email" id="email" placeholder="Email" required>
<input type="text" id="mobile" placeholder="Telefonszám" required>
<h4 class="contactus">Lépjen velünk kapcsolatba!</h4>
<textarea id="texti" required></textarea>
<input type="submit" value="Elküldés" id="button">
</form>
</div>
</main>
<footer>
<div class="footer-container">
<!--COMPANY INFORMATION, CONTATCTS-->
<div class="footer-top">
<div>
<article>
<h2>Elérhetőségeink</h2>
<div class="cellphone">
<img src="assets/png/telephone.png" alt="phone-icon">
<h3><span>Telefonszám:</span> +36709424298</h3>
</div>
<div class="internet">
<img src="assets/png/mail.png" alt="email-icon">
<h3><span>E-mail:</span> eckertmuvek#gmail.com</h3>
</div>
<div class="headquarter">
<img src="assets/png/location.png" alt="company-icon">
<h3><span>Telephely:</span> Budapest, 1182 Török Bálint u. 16/b</h3>
</div>
<div class="opening-hours">
<img src="assets/png/clock.png" alt="op-icon">
<h3><span>Nyitvatartási idő:</span> hétfő - péntek(7:00 - 17:30)</h3>
</div>
</article>
</div>
<!--TEXT-->
<div class="text-container">
<h4>Céginformációk</h4>
<p>
<ol>
<li>
<h5>Cégjegyzékszám: </h5>
<p> 01 09 996342</p>
</li>
<li>
<h5>Adószám: </h5>
<p>24222716243</p>
</li>
<li>
<h5>Számlaszám: </h5>
<p>112131423-43242142-432412421</p>
</li>
<li>
<h5>Cégnév: </h5>
<p>Eckert Művek Korlátolt Felelősségű Társaság</p>
</li>
</ol>
</p>
</div>
<!--
<div class="text-container">
<h4>Ttitle-1</h4>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit.
Dicta modi laborum quibusdam quis natus debitis qui dolor
voluptatibus ab sit, cum saepe enim unde doloribus veniam
numquam perspiciatis optio impedit.</p>
</div>
-->
<!--POLICIES-->
<div class="policies">
Impresszum
GDPR Tájékoztató
Süti Tájékoztató
</div>
</div>
<!--MAP-->
<div class="map">
<iframe src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d2699.366130757782!2d19.217992451587673!3d47.42430370844346!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x4741c1f21fa88e89%3A0x44673b68b84b51c9!2zQnVkYXBlc3QsIFTDtnLDtmsgQsOhbGludCB1LiAxNmIsIDExODI!5e0!3m2!1shu!2shu!4v1672662477180!5m2!1shu!2shu"
height="400" style="border:0;" allowfullscreen="" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>
</div>
<!--SOCIAL MEDIA ICONS-->
<div class="social-media-icons">
<div class="sm-container" id="insta">
<div class="sm-icon">
</div>
</div>
<div class="sm-container" id="github">
<div class="sm-icon">
</div>
</div>
<div class="sm-container" id="facebook">
<div class="sm-icon">
</div>
</div>
<div class="sm-container" id="linkedin">
<div class="sm-icon">
</div>
</div>
</div>
<div class="footer-bottom">
<p>© Eckert Művek Kft. Minden jog fenntartva.</p>
</div>
</div>
</footer>
<script src="contacts.js"></script>
</body>
</html>
And here is my CSS code:
#import url('https://fonts.googleapis.com/css2?family=Poppins:wght#100;200;300;400;500;600;700;800;900&display=swap');
:root {
--nav-height: 100px; /*80%*/
}
*,
*::before,
*::after {
box-sizing: border-box;
margin: 0;
padding: 0;
font-family: 'Poppins', sans-serif;
}
html {
scroll-behavior: smooth;
}
body {
min-height: 100vh;
width: 100%;
font-size: 12px;
font-family: sans-serif;
}
.floating-btn {
position: fixed;
bottom: 3.5vh;
right: 0;
width: 50px;
height: 50px;
z-index: 100;
background-color: yellow;
border-radius: 50%;
padding: 10px;
box-shadow: 0 0 5px hsla(0, 0%, 0%, hsla(0,0%,0%,0.5));
cursor: pointer;
margin-right: 1rem;
border: 1px solid #000;
}
.show-btn {
display: block;
}
header {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100px;
z-index: 100;
background-color: #000;
}
/*Srcollbar*/
::-webkit-scrollbar{
width: 15px;
background: #000;
}
::-webkit-scrollbar-thumb {
background: yellow;
border-radius: 10px;
border: 1px solid black;
}
::-webkit-scrollbar-thumb:active {
background: orangered;
}
nav {
display: flex;
width: min(90%, 1200px);
height: inherit;
align-items: center;
justify-content: flex-start;
margin-inline: unset;
display: flex;
justify-content: flex-start;
align-items: center;
font-size: 20px;
left: 2.5rem;
gap: 1rem;
/*margin-top: -2.5rem;*/
}
nav a {
max-height: var(--nav-height);
align-items: center;
margin-inline: auto;
font-size: 20px;
position: relative;
height: 100%;
}
nav ul {
display: flex;
gap: 1rem;
width: 100%;
list-style: none;
margin-top: 3rem;
}
.nav-item a {
color: white;
text-transform: uppercase;
text-decoration: none;
font-weight: bold;
font-size: 20px;
height: 100%;
margin: .5em .8em;
padding: 10px;
}
.nav-item a::before,
.nav-item a::after {
content: '';
height: 14px;
width: 14px;
position: absolute;
transition: all .35s ease;
opacity: 0;
}
nav a::before {
content: '';
right: 0;
top: 0;
border-top: 3px solid #ffed4b;
border-right: 3px solid #fdcd3b;
transform: translate(-100%, 50%); /*-100%, 50%*/
}
.nav-item a:after {
content: '';
left: 0;
bottom: 0;
border-bottom: 3px solid #fdcd3b;
border-left: 3px solid #ffed4b;
transform: translate(100%, -50%); /*100%, -50%*/
}
.nav-item a:hover:before,
.nav-item a:hover:after{
transform: translate(0,0);
opacity: 1;
}
.nav-item a:hover {
text-decoration: underline;
color:yellow;
}
.container{
min-height: 100vh;
width: 99.vw;
background: #08071d;
display: flex;
justify-content: center;
align-items: center;
background: url("assets/images/mainpage/106811484-1608045351058-gettyimages-1126750618-dsc_1540.jpeg") no-repeat center center/cover;
}
.container form{
width: 670px; /*670px*/
height: 450px;
display: flex;
justify-content: center;
box-shadow: 20px 20px 50px rgba(0,0,0,0.5);
border-radius: 15px;
background: rgba(255,255,255,0.1);
backdrop-filter: blur(10px);
flex-wrap: wrap;
overflow-x: hidden;
}
.container form h1{
color: #fff;
font-weight: 500;
margin-top: 20px;
width: 500px;
text-align: center;
}
.container form input{
width: 290px;
height: 40px;
padding-left: 10px;
outline: none;
border: none;
font-size: 25px;
margin-bottom: 10px;
background: none;
border-bottom: 2px solid #fff;
}
.container form input::placeholder{
color: #ddd;
}
.container form #lastName,
.container form #mobile{
margin-left: 20px;
}
.container form h4{
color: #fff;
font-weight: 300;
width: 600px;
margin-top: 20px;
}
.container form textarea{
background: none;
border: none;
border-bottom: 2px solid #fff;
color: #fff;
font-weight: 200;
font-size: 25px;
padding: 10px;
outline: none;
min-width: 600px;
max-width: 600px;
min-height: 80px;
max-height: 80px;
}
.contactus {
font-size: 18px;
}
input[type="text"]:focus, input[type="email"]:focus, #texti:focus {
border-bottom: 3px solid #fdcd3b;
}
textarea::-webkit-scrollbar{
width: 1em;
}
textarea::-webkit-scrollbar-thumb{
background-color: rgba(194,194,194,0.713);
}
.container form #button{
border: 1px solid;
background: transparent;
border-radius: 50px;
margin-top: 20px;
font-weight: 600;
font-size: 20px;
color: #fff;
width: 100px;
padding: 0;
margin-right: 500px;
margin-bottom: 30px;
transition: 0.3s;
}
.container form #button:hover{
opacity: 0.9;
transform: scale(1.2);
background-color: black;
color: yellow;
}
/*FOOTER*/
footer {
width: 100%;
background-color: #000;
padding-block: 4rem;
color: white;
}
.footer-container {
display: flex;
flex-direction: column;
justify-content: space-between;
margin-inline: auto;
width: min(90%, 1200px);
}
.footer-top {
width: 100%;
height: 100%;
color: #fff;
font-size: 10px;
display: flex;
justify-content: space-around;
}
.footer-top h2 {
text-align: center;
justify-content: center;
align-items: center;
}
.footer-top article div {
line-height: 2.5rem;
}
.footer-top article div:first-of-type {
margin-top: 1rem;
}
.footer-top img {
height: 64px;
}
.text-container p {
margin-top: 2rem;
}
.text-container ol li {
line-height: 1.5rem;
}
/*CONTACT ICONS*/
.cellphone img, .internet img, .headquarter img, .opening-hours img{
background-color: yellow;
border-radius: 50px;
transition: all 0.3s linear;
}
footer img:hover {
background-color: orangered;
border-radius: 40px;
transform: rotate(-360deg);
}
.footer-bottom {
text-align: center;
margin-top: 2rem;
}
span {
color: yellow;
}
.text-container {
justify-content: space-between;
width: 20vw;;
font-size: 0.8rem;
}
/*POLICIES LINKS*/
.policies {
display: flex;
flex-direction: column;
font-size: 14px;
text-transform: uppercase;
}
.policies a {
color: yellow;
font-size: 10px;
line-height: 2rem;
}
.policies a:hover {
color: orangered;
}
/*MAP*/
.map {
margin-inline: auto;
}
/*SOCIAL MEDIA ICONS*/
.social-media-icons {
width: 100%;
display: flex;
justify-content: center;
align-items: center;
}
.sm-container {
display: flex;
justify-content: center;
gap: 2rem;
padding:1rem;
border: 1px black;
width: 100%;
height: 100%;
}
.sm-container a:active {
color: yellow;
}
.fa {
border-radius: 50%;
width: 100%;
height: 100%;
display: inline-block;
font: normal normal normal 14px/1 FontAwesome;
font-size: 30px;
/**/
}
.fa-instagram {
background: #125688;
color: white;
padding: 1rem;
}
.fa-github {
background: white;
color: black;
padding: 1rem;
}
.fa-facebook {
background: #4267B2;
color: white;
padding: 1rem;
}
.fa-linkedin {
background: #3B5998;
color: white;
padding: 1rem;
}
.sm-icon {
transition: all 0.3s linear;
}
.sm-icon:hover {
transform: scale(1.2);
}
.fa:hover {
background-color: #fdcd3b;
}
/*MOBILE MENU*/
.mobile-menu {
display: none;
}
.mobile-menu {
display: flex;
width: 100%; /*.line a szülő tehát 40px a width*/
height: calc(100vh - 80px);
align-items: center;
justify-content: center;
position: absolute;
top: 80px;
left: 0;
background-color: black;
transform: translate(-100%);
transition: all 0.4s ease;
z-index: 100;
}
.mobile-menu-on {
display: flex; /**/
transform: translate(0);
}
.m-menu {
display: flex;
flex-direction: column;
gap: 2rem;
text-align: center;
font-size: 1.4rem;
}
/*hamburger icon*/
.header-right-gap {
width: 100px;
margin-left: 2rem;
}
.hamburger {
display: none;
position: fixed;
width: 50px;
height: 50px;
border: none;
background-color: transparent;
top: 0;
left: 1;
margin-top: 1.5rem;
}
.hamburger:hover {
border: 6px solid;
border-color: yellow;
width: 43px;
margin-left: 4px;
transform: scale(1.2);
}
.hamburger:hover .line.line-1 {
/*display: none;*/
transform: rotate(45deg) translateY(7.5px);
background-color: yellow;
}
.hamburger:hover .line.line-2 {
display: none;
}
.hamburger:hover .line.line-3 {
/*display: none;*/
transform: rotate(-45deg) translateY(-7.5px);
background-color: yellow;
}
.line {
transition: all .4s ease;
width: 40px;
height: 5px;
background-color: white;
margin-block: 5px;
border-radius: 10px;
}
/*Media query*/
#media (max-width: 1200px) {
.hamburger {
display: block;
}
#desktop-menu {
display: none;
}
}
#media (max-width: 900px) {
footer nav ul {
flex-direction: column;
}
footer nav ul li a {
font-size: 15px;
/*padding: 15px;*/
}
}
#media (max-width: 750px) {
.footer-container {
display: flex;
flex-wrap: wrap;
}
footer nav ul li a {
font-size: 10px;
padding: 15px;
}
.text-container p {
font-size: 10px;
}
}
#media (max-width: 600px) {
.container form {
width: 470px;
}
.container form input {
width: 160px;
}
.container form #button, .container form h4 {
margin-inline: auto;
}
.container form textarea {
min-width: 300px;
max-width: 300px;
}
}
#media (max-width: 400px) {
.container {
max-width: 100%;
height: 100%;
overflow: hidden;
}
.container form {
max-width: 100%;
padding-top: 40px;
padding-bottom: 10px;
}
.container form input, h4 {
text-align: center;
}
.container form input {
width: 160px;
}
.container form #button, .container form h4 {
margin-inline: auto;
}
.container form textarea {
align-items: center;
min-width: 300px;
max-width: 300px;
}
.text-container {
width: 70vw;
}
.container form #button {
display: flex;
flex-direction: column;
}
footer {
width: 400px;
}
.footer-top {
display: flex;
flex-direction: column;
align-items: center;
}
}
I once had a similar problem and it was due to margin of one element being bigger than it should be, and it just made that div bigger and pushed it out of viewport, so you could check your margins, I can see that you have quite a lot of margins, inline and to margin-right as well.

Webpage starts zoomed out on mobile devices

I have created a website for desktop and mobile, and it has to be responsive. My problem is that when I resize the browser all the content gets zoomed out instead of adapting. I also have an issue with the HTML. why is it only taking up 1/3 of the page according to dev tools and when I add width:1100px to my sections it renders the desktop version, but when I take it away it floats to the left side? Why is this happening?
Images of the problem:
Image 1
Image 2
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Source Sans Pro', sans-serif;
background-color: black;
color: white;
line-height: 30px;
}
html {
width:100%;
}
img {
width: 100%;
}
h1 {
font-weight: 700;
font-size: 44px;
margin-bottom: 40px;
line-height: 50px;
}
h3 {
width: 100%;
}
/* header */
header {
display: flex;
background-color: black;
height: 80px;
min-width: 1100px;
justify-content: right;
align-items: center;
margin-bottom: 50px;
border-bottom: 1px solid white;
}
nav ul li {
display: inline-block;
list-style-type: none;
margin-right: 20px;
}
.nav-links{
color: white;
font-size: 18px;
}
/* Banner */
.banner {
display: flex;
justify-content: space-around;
align-items: center;
min-height: 500px;
width: 100%;
}
.banner-text-container {
max-width: 30%;
font-size: 22px;
}
span {
color: #11cc9e;
}
.consultation-link{
color: #11cc9e;
text-decoration: none;
margin-top: 30px;
font-weight: 900;
display: block;
border: 1px solid white;
max-width: 40%;
text-align: center;
padding: 5px;
}
.consultation-link:hover{
background-color: #fff;
}
/* About */
.about {
display: flex;
justify-content: space-around;
align-items: center;
min-height: 600px;
min-width: 1100px;
}
.about-text-container {
max-width: 40%;
font-size: 22px;
margin-left: 20px;
}
.about-img{
width: 400px;
margin-right: 22px;
}
.about-title {
margin-bottom: 40px;
}
.about-us-link{
color: #11cc9e;
text-decoration: none;
margin-top: 30px;
font-weight: 900;
display: block;
border: 1px solid white;
text-align: center;
max-width: 25%;
padding: 5px;
}
.about-us-link:hover{
background-color: #fff;
}
/* Join */
.join {
min-height: 600px;
min-width: 1100px;
max-width: 100%;
}
.join-header{
width: 100%;
text-align: center;
margin-top: 150px;
font-size: 40px;
}
.container-boxes{
position: relative;
top: 0;
bottom: 0;
display: flex;
flex-wrap: wrap;
justify-content: space-evenly;
align-items: center;
min-height: 500px;
min-width: 1100px;
}
.box {
position: relative;
overflow: hidden;
transition: 0.5s;
height: 200px;
width: 300px;
}
.box:hover{
z-index: 1;
transform: scale(1.25);
box-shadow: 0 25px 40px rgba(0, 0, 0, .5);
cursor: pointer;
}
.box .imgBX{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.box .imgBX img{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
}
.box .imgBX:before{
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1;
background: linear-gradient(180deg,rgba(0,0,0.7),#79dbc3);
mix-blend-mode: multiply;
opacity: 0;
transition: 0.5s;
}
.box:hover .imgBX:before {
opacity: 1;
}
.box .imgBX img{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
}
.content{
display: flex;
flex-direction: column;
text-align: center;
position: absolute;
top: 20%;
bottom: 40%;
width: 100%;
height: 100%;
z-index: 1;
padding: 20px;
visibility: hidden;
}
.box:hover .content{
visibility: visible;
}
/* Quote section */
.quote-section {
display: flex;
justify-content: center;
max-width: 100%;
min-height: 500px;
min-width: 1100px;
}
.quote-container {
display: flex;
flex-direction: column;
flex-wrap: wrap;
align-items: center;
justify-items: center;
max-width: 50%;
font-size: 22px;
text-align: center;
}
.quote {
line-height: 90px;
font-size: 150px;
font-style: italic;
color: #11cc9e;
text-indent: -37px;
font-weight: 600;
width: 37px;
}
.quote-img{
width: 90px;
margin: 40px auto;
}
.person-name{
color: #ccc;
}
.person-role{
font-size: 17px;
color: #ccc;
}
/* Footer */
footer {
text-align: center;
margin-top: 100px;
padding-top: 50px;
max-width: 100%;
min-height: 200px;
min-width: 1100px;
border-top: 1px solid #fff;
}
<!DOCTYPE html>
<html lang="en">
<head>
<title>Codes</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<ink rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght#400;600&display=swap" rel="stylesheet">
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="./Resources/styles.css">
</head>
<body>
<header>
<!-- insert logo -->
<nav class="nav-links">
<ul>
<li>About</li>
<li>Peer group</li>
<li>Review</li>
</ul>
</nav>
</header>
<section class="banner">
<div class="banner-text-container">
<h1>Build. Grow. <span class="color-Learn">Learn.</span></h1>
<p>Unlock your potential with your peers!, using Blockchain, Fintech or the IT outsourcing company Boosty Labs helps you create an innovative end to end product or augment your team with the right experts.</p>
<a class="consultation-link" href="#">Free consultation </a>
</div>
<div class="banner-img">
<img src="./Resources/Images/banner.png" alt="">
</div>
</section>
<section class="about">
<div class="about-text-container">
<h2 class="about-title">Who we are</h2>
<p>Here you can find our ,collection of coding, data science and statistics tutorials with examples in R, Python, JavaScript and Python. As you click through, you'll notice that some tutorials have ribbons on their logos - they are part of our free and self-paced online course Data Science for Ecologists and Environmental Scientists! Yellow for the Stats from Scratch stream, blue for Wiz of Data Viz and purple for Mastering Modelling.</p>
<a class="about-us-link" href="#">More about us </a>
</div>
<div class="about-img">
<img src="./Resources/Images/whoweare.png" alt="">
</div>
</section>
<section class="join">
<h3 class="join-header" >Join a peer group!</h3>
<div class="container-boxes">
<div class="box">
<div class="imgBX">
<img src="./Resources/Images/box-1.png" alt="">
</div>
<div class="content">
<h3>AI</h3>
<P>Discover The Complete Range Of Artificial Intelligence Solutions.</P>
</div>
</div>
<div class="box">
<div class="imgBX">
<img src="./Resources/Images/box-2.png" alt="">
</div>
<div class="content">
<h3 class="frontend-title">Frontend Dev</h3>
<p>Discover The Complete Range Of Frontend Solutions.</p>
</div>
</div>
<div class="box">
<div class="imgBX">
<img src="./Resources/Images/box-3.png" alt="">
</div>
<div class="content">
<h3>Microsoft systems</h3>
<p>Discover The Complete Range Of Microsoft Solutions.</p>
</div>
</div>
</div>
</section>
<section class="quote-section">
<div class="quote-container">
<div class="quote">"</div>
<p class="p-quote">In coded, the progress of the topics and the exercises are really good. It's so nice to practice on good story told tasks. Also if you are stuck, it is nice to have a broad range of coders around in the peer groups that you can get the answers you are looking for.</p>
<div class="quote-img">
<img src="./Resources/Images/person-img.png" alt="">
</div>
<div class="person-name">Peter Gangland </div>
<div class="person-role">Director of business dev at <span>Microsoft</span></div>
</div>
</section>
<footer>
<div id="contact">
<h2>
Contact us</h5>
<h5>coded#peers.com</h5>
<h5>831-867-5309</h5>
</div>
<div id="copyright">
<h5>#copyright coded Enterprises 2022</h5>
</div>
</footer>
</body>
</html>
Some issues I noticed:
The horizontal scrollbar opens when the screen width is reduced after the web page is loaded; This situation is not suitable for responsive design. To avoid this situation, add overflow-x: hidden to the <body> I used the style.
You should use media queries to make a mobile responsive website. In this example I've edited the <img> element to remove it when the page shrinks.
I completely removed the width: 1100px style you added to the elements. You don't need to use this type to give width to the element.
On mobile-responsive websites, <img> elements are displayed on the new line at 100% width; you can implement this idea by using media queries at this stage.
You can visit this link for media query blocks according to the display size of the devices in CSS.
For example, the styles in #media only screen and (max-width: 880px){} are applied when the page size drops below 880px:
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Source Sans Pro', sans-serif;
background-color: black;
color: white;
line-height: 30px;
width:100%;
overflow-x: hidden;
}
img {
width: 100%;
}
h1 {
font-weight: 700;
font-size: 44px;
margin-bottom: 40px;
line-height: 50px;
}
h3 {
width: 100%;
}
header {
display: flex;
background-color: black;
height: 80px;
justify-content: right;
align-items: center;
margin-bottom: 50px;
border-bottom: 1px solid white;
}
nav ul li {
display: inline-block;
list-style-type: none;
margin-right: 20px;
}
.nav-links{
color: white;
font-size: 18px;
}
.banner {
display: flex;
justify-content: space-around;
align-items: center;
min-height: 500px;
width: 100%;
}
.banner-text-container {
max-width: 30%;
font-size: 22px;
}
span {
color: #11cc9e;
}
.consultation-link{
color: #11cc9e;
text-decoration: none;
margin-top: 30px;
font-weight: 900;
display: block;
border: 1px solid white;
max-width: 40%;
text-align: center;
padding: 5px;
}
.consultation-link:hover{
background-color: #fff;
}
.about {
display: flex;
justify-content: space-around;
align-items: center;
min-height: 600px;
}
.about-text-container {
max-width: 40%;
font-size: 22px;
margin-left: 20px;
}
.about-img{
width: 400px;
margin-right: 22px;
}
.about-title {
margin-bottom: 40px;
width: 100% !important;
}
.about-us-link{
color: #11cc9e;
text-decoration: none;
margin-top: 30px;
font-weight: 900;
display: block;
border: 1px solid white;
text-align: center;
max-width: 25%;
padding: 5px;
}
.about-us-link:hover{
background-color: #fff;
}
.join {
/* */
}
.join-header{
width: 100%;
text-align: center;
margin-top: 75px;
font-size: 40px;
}
.container-boxes{
position: relative;
top: 0;
bottom: 0;
display: flex;
flex-wrap: wrap;
justify-content: space-evenly;
align-items: center;
min-height: 500px;
}
.box {
position: relative;
overflow: hidden;
transition: 0.5s;
height: 200px;
width: 300px;
}
.box:hover{
z-index: 1;
transform: scale(1.25);
box-shadow: 0 25px 40px rgba(0, 0, 0, .5);
cursor: pointer;
}
.box .imgBX{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.box .imgBX img{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
}
.box .imgBX:before{
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1;
background: linear-gradient(180deg,rgba(0,0,0.7),#79dbc3);
mix-blend-mode: multiply;
opacity: 0;
transition: 0.5s;
}
.box:hover .imgBX:before {
opacity: 1;
}
.box .imgBX img{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
}
.content{
display: flex;
flex-direction: column;
text-align: center;
position: absolute;
top: 20%;
bottom: 40%;
width: 100%;
height: 100%;
z-index: 1;
padding: 20px;
visibility: hidden;
}
.box:hover .content{
visibility: visible;
}
/* Quote section */
.quote-section {
display: flex;
justify-content: center;
max-width: 100%;
min-height: 500px;
}
.quote-container {
display: flex;
flex-direction: column;
flex-wrap: wrap;
align-items: center;
justify-items: center;
max-width: 50%;
font-size: 22px;
text-align: center;
}
.quote {
line-height: 90px;
font-size: 150px;
font-style: italic;
color: #11cc9e;
text-indent: -37px;
font-weight: 600;
width: 37px;
}
.quote-img{
width: 90px;
margin: 40px auto;
}
.person-name{
color: #ccc;
}
.person-role{
font-size: 17px;
color: #ccc;
}
footer {
text-align: center;
margin-top: 100px;
padding-top: 50px;
max-width: 100%;
min-height: 200px;
border-top: 1px solid #fff;
}
#media only screen and (max-width: 1279px) {
nav ul li {
display: inline-block;
list-style-type: none;
margin-right: 20px;
color: #11cc9e;
}
}
#media only screen and (max-width: 880px){
html{
margin-left: 25px !important;
margin-right: 25px !important;
}
.banner-text-container {
max-width: 100%;
font-size: 20px;
}
img{
display: none;
}
.about-text-container {
max-width: 100% !important;
font-size: 22px;
}
.about-text-container {
margin-left: 0px;
}
.about {
display: inline;
}
.banner {
display: inline;
justify-content: space-around;
width: 100%;
}
.consultation-link{
color: #11cc9e;
text-decoration: none;
margin-bottom: 50px;
font-weight: 900;
display: block;
border: 1px solid white;
max-width: 100%;
text-align: center;
padding: 5px;
}
.about-us-link {
color: #11cc9e;
text-decoration: none;
margin-top: 30px;
font-weight: 900;
display: block;
border: 1px solid white;
text-align: center;
max-width: 100%;
padding: 5px;
}
.join{
display: none;
}
.join-header{
display: none;
}
.quote-section{
display: none;
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<title>Codes</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<ink rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght#400;600&display=swap" rel="stylesheet">
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<!-- insert logo -->
<nav class="nav-links">
<ul>
<li>About</li>
<li>Peer group</li>
<li>Review</li>
</ul>
</nav>
</header>
<section class="banner">
<div class="banner-text-container">
<h1>Build. Grow. <span class="color-Learn">Learn.</span></h1>
<p>Unlock your potential with your peers!, using Blockchain, Fintech or the IT outsourcing company Boosty Labs helps you create an innovative end to end product or augment your team with the right experts.</p>
<a class="consultation-link" href="#">Free consultation </a>
</div>
<div class="banner-img">
<img src="https://via.placeholder.com/400" alt="">
</div>
</section>
<section class="about">
<div class="about-text-container">
<h2 class="about-title">Who we are</h2>
<p>Here you can find our ,collection of coding, data science and statistics tutorials with examples in R, Python, JavaScript and Python. As you click through, you'll notice that some tutorials have ribbons on their logos - they are part of our free and self-paced online course Data Science for Ecologists and Environmental Scientists! Yellow for the Stats from Scratch stream, blue for Wiz of Data Viz and purple for Mastering Modelling.</p>
<a class="about-us-link" href="#">More about us </a>
</div>
<div class="about-img">
<img src="https://via.placeholder.com/400" alt="">
</div>
</section>
<section class="join">
<h3 class="join-header" >Join a peer group!</h3>
<div class="container-boxes">
<div class="box">
<div class="imgBX">
<img src="https://via.placeholder.com/400" alt="">
</div>
<div class="content">
<h3>AI</h3>
<P>Discover The Complete Range Of Artificial Intelligence Solutions.</P>
</div>
</div>
<div class="box">
<div class="imgBX">
<img src="https://via.placeholder.com/400" alt="">
</div>
<div class="content">
<h3 class="frontend-title">Frontend Dev</h3>
<p>Discover The Complete Range Of Frontend Solutions.</p>
</div>
</div>
<div class="box">
<div class="imgBX">
<img src="https://via.placeholder.com/400" alt="">
</div>
<div class="content">
<h3>Microsoft systems</h3>
<p>Discover The Complete Range Of Microsoft Solutions.</p>
</div>
</div>
</div>
</section>
<section class="quote-section">
<div class="quote-container">
<div class="quote">"</div>
<p class="p-quote">In coded, the progress of the topics and the exercises are really good. It's so nice to practice on good story told tasks. Also if you are stuck, it is nice to have a broad range of coders around in the peer groups that you can get the answers you are looking for.</p>
<div class="quote-img">
<img src="https://via.placeholder.com/400" alt="">
</div>
<div class="person-name">Peter Gangland </div>
<div class="person-role">Director of business dev at <span>Microsoft</span></div>
</div>
</section>
<footer>
<div id="contact">
<h2>
Contact us</h5>
<h5>coded#peers.com</h5>
<h5>831-867-5309</h5>
</div>
<div id="copyright">
<h5>#copyright coded Enterprises 2022</h5>
</div>
</footer>
</body>
</html>
For making your website responsive you need to use media queries. It's like you tell the browser how to style your website in different sizes. I think your problem with your sections might also get solved if you try to make your website responsive.

Why are these navbar links overflowing on top of section outside the header?

I am trying to get the links on the navbar to take full width and NOT take any of the area of the background image placed on the following section when the page is displayed on a smaller viewport #media (max-width: 900px).
Why is the hamburger menu icon not displaying?
I am trying to get navmenu items stacked and then a background image to display in full on a smaller viewport.
header {
position: fixed;
z-index: 100;
width: 100%;
}
.navbar {
display: flex;
justify-content: space-between;
align-items: center;
background: var(--secondary-dark);
color: var(--main-white);
padding: 5px 30px;
height: 90px;
}
.logo {
font-size: var(--fs-600);
margin: 0.5rem;
text-decoration: none;
font-family: var(--ff-nav);
font-weight: var(--fw-400);
letter-spacing: 1px;
}
.navbar-items ul {
margin: 0;
padding: 0;
display: flex;
}
.navbar-items li a {
text-decoration: none;
color: var(--main-white);
padding: 1rem;
display: block;
}
.navbar-items li:hover a {
color: var(--blue-primary);
}
.toggle-button a {
position: absolute;
top: 0.75rem;
right: 1rem;
display: flex;
flex-direction: column;
justify-content: space-between;
width: 30px;
height: 21px;
}
.toggle-button a .bar {
height: 3px;
width: 100%;
background-color: var(--main-white);
border-radius: 10px;
}
#media (max-width: 900px) {
.toggle-button {
display: flex;
}
.navbar-items {
/* display: none; */
width: 100%;
background-color: var(--secondary-dark);
}
.navbar {
flex-direction: column;
align-items: flex-start;
}
.navbar-items ul {
flex-direction: column;
width: 100%;
}
.navbar-items li {
text-align: center;
}
.navbar-items li a {
padding: .5rem 1rem;
width: 100;
}
.navbar-items.active {
display: flex;
}
}
/* //////////////////////
Main
/////////////////////// */
.welcome {
position: relative;
outline: 2px solid red;
padding-top: 70px;
height: 700px;
background-image: url("/img/background.png");
background-position: center;
background-size: cover;
}
.welcome p {
position: absolute;
display: block;
bottom: 0;
right: 0;
margin: 20px 50px;
font-size: 3em;
color: var(--clr-section-background);
letter-spacing: 0.5px;
}
<header>
<nav class="navbar">
<div class="logo">
<span>Brand</span>
</div>
<div>
<a href="#">
<span class="bar"></span>
<span class="bar"></span>
<span class="bar"></span>
</a>
</div>
<div class="navbar-items">
<ul>
<li>Home</li>
<li>About</li>
<li>Services</li>
<li>
Blog
</li>
<li>Newsletter</li>
</ul>
</div>
</nav>
</header>
<!--mission statement------------------------------------------>
<section class="welcome">
<div>
<p>#OnPoint</p>
</div>
</section>
Problem resolved, I just needed to add a z-index on navbar and remove padding on ul in order to have the hamburger menu displaying on full width on smaller viewports.

Why flexbox is moving left when i resize the window

when i resize the window the header moves to the left. And the flexbox dont stay in the center.And sorry im new to stackoverflow so i forgive my mistakes.see this image for a better understanding
(Please skip this text cause stackoverflow is blocking my post jdjdjd sksjdhd sisjjdjd didjjd sidjf sijdjd sidjjd idjdjd idjdjjd)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Md Hasan</title>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="style.css" />
</head>
<body>
<header class="header">
<div class="header-left">
<a href="#"
><img
class="logo"
src="gallery/received_344045126587298.jpeg"
width="100px"
height="70px"
alt="logo"
/>
</a>
<a href="#">
<h1>Md Hasan</h1>
</a>
</div>
<div class="header-right">
Contact
Gallery
</div>
</header>
<div class="container">
<section id="about">
<div class="aboutText">
<div class="f1">
<h1>Who Is Hasan</h1>
<p>
Hasan is a Business man. He runs a Rubber Factory. He is a Good
person with a kind Heart. This website is just a gift for him
</p>
</div>
<div class="f2">
<a
href="https://www.facebook.com/messages/t/100011445344575"
target="_blank"
><button id="btn" onmouseout="btnf()" onmouseover="btnfuc()">
DM Hasan on FB
</button></a
>
</div>
</div>
<div class="aboutImg">
<img src="gallery/hasan.jpg" alt="About Hasan" class="aboutImg" />
</div>
</section>
<hr />
<section id="gallery">
<h1>Gallery</h1>
<p>Here you can see some rare pictures of Living Legend Md Hasan</p>
<div class="flex">
<img src="gallery/IMG20180305171539.jpg" alt="" />
<img src="gallery/IMG20180616172814.jpg" alt="" />
<img class="im3" src="gallery/IMG_20190404_201412.jpg" alt="" />
</div>
</section>
<hr />
<section id="contact">
<h1>Contact Us</h1>
<p>
<i>Need Hasan's Facebook Id? ok here you go.</i>
<a href="https://www.facebook.com/profile.php?id=100011445344575">
<img
class="fbLogo"
src="gallery/Facebook-logo-768x538.png"
alt="fb-link"
/>
Md Hasan
</a>
</p>
</section>
</div>
<footer class="footer">
<em class="em1"
>Created by - Ahmed Rafin | I'm a professional. Please give me Job.</em
>
<em class="em2">
<a href="https://facebook.com/psycho.rafin"
>Contact Me on
<img
class="fbLogo"
src="gallery/Facebook-logo-768x538.png"
alt="" /></a
></em>
</footer>
<script>
btnfuc = () => {
console.log('button hovered');
document.getElementById('btn').style.backgroundColor = 'red';
};
btnf = () => {
document.getElementById('btn').style.backgroundColor = 'blueviolet';
};
</script>
</body>
</html>
now this is the css part . you can check this . and again sorry if my mistakes guys
* {
margin: 0;
padding: 0;
}
/* Header section start from here */
header {
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
background-color: black;
overflow: auto;
}
header .header-left {
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
flex-basis: 50%;
}
header .logo {
border-radius: 50%;
margin: 10px;
}
.header-left a {
text-decoration: none;
color: white;
}
header a:hover {
color: grey;
}
.header-right {
display: flex;
justify-content: flex-end;
align-items: center;
}
.header-right a {
margin: 10px;
font-size: 20px;
text-transform: uppercase;
text-decoration: none;
color: white;
padding: 10px;
}
.header-right a:hover {
color: black;
background-color: yellowgreen;
}
/* Header section end */
/* Container and after that about hasan section */
.container {
width: 90%;
margin: auto;
}
#about {
display: flex;
justify-content: space-between;
align-items: center;
margin: 25px;
}
.aboutText {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
section .aboutImg {
width: 500px;
height: auto;
border-radius: 10px;
}
section .aboutText {
width: 50%;
}
#about h1 {
font-size: 50px;
text-align: center;
margin-bottom: 15px;
}
#about p {
font-size: 18px;
font-style: italic;
}
#about button {
padding: 10px 30px;
background-color: rgb(61, 61, 230);
margin: 25px auto;
font-size: 18px;
}
/* About section end */
/* Gallery section starts */
#gallery h1 {
font-size: 50px;
text-align: center;
margin: 25px 0;
}
#gallery p {
font-size: 18px;
font-style: italic;
text-align: center;
margin: 25px 0;
}
section .flex {
display: flex;
justify-content: center;
align-items: center;
}
.flex img {
margin: 5px;
width: 300px;
height: 300px;
border: 2px solid black;
border-radius: 5px;
}
.flex img:nth-child(3) {
transform: rotate(-90deg);
}
/* Gallery section end */
/* Contact us page */
#contact h1 {
font-size: 50px;
text-align: center;
margin: 25px 0;
}
#contact p {
font-size: 18px;
font-style: italic;
text-align: center;
margin: 25px 0;
}
#contact img {
width: 50px;
height: auto;
position: relative;
top: 13px;
}
#contact a {
text-decoration: none;
color: rgb(70, 21, 21);
}
#contact a:hover {
color: green;
}
/* now the last foooter area */
footer {
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
background-color: black;
}
footer em {
color: white;
font-size: 15px;
padding: 30px;
}
footer img {
width: 30px;
height: auto;
position: relative;
top: 5px;
}
footer a {
color: white;
text-decoration: none;
}
footer a:hover {
color: green;
}
/* end for computers and now media queries */
#media screen and (max-width: 1200px) {
header {
flex-direction: column;
justify-content: center;
/* align-items: center; */
}
}
Please try this code, To Why flexbox is moving left when i resize the window
html {
background-color: #141E30;
margin: 0;
padding: 0;
}
.sidebar {
display: flex;
flex-direction: column;
width: 300px;
top: 0;
bottom: 0;
position: fixed;
overflow: auto;
background: #0a0c0f;
color: #EAE9E9;
}
.sidebar__profile {
padding: 16px;
display: flex;
flex-direction: column;
align-items: center;
}
.sidebar__menuitem {
padding-bottom: 10px;
display: flex;
align-items: center;
flex-shrink: 0;
height: 30px;
}
.count {
margin-left: auto;
margin-right: 20px;
border-radius: 6px;
padding: 2px 5px;
background-color: #EAE9E9;
color: #0a0c0f;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>title</title>
</head>
<body>
<div class="sidebar">
<div>
<div class="sidebar__profile">
<img src="http://chittagongit.com//images/avatar-icon/avatar-icon-4.jpg" height=50px alt="image" class="sidebar__profile__avatar" />
<div class="sidebar__profile__name">User Name</div>
</div>
</div>
<div class="sidebar__menuitem">
<div>Menu Item 1</div>
<div class="count">2</div>
</div>
<div class="sidebar__menuitem">
<div>Menu Item 2</div>
<div class="count">2</div>
</div>
<div class="sidebar__menuitem">
<div>Menu Item 3</div>
<div class="count">2</div>
</div>
<div class="sidebar__menuitem">
<div>Menu Item 4</div>
<div class="count">2</div>
</div>
<div class="sidebar__menuitem">
<div>Menu Item 5</div>
<div class="count">2</div>
</div>
<div class="sidebar__menuitem">
<div>Menu Item 6</div>
<div class="count">2</div>
</div>
<div class="sidebar__menuitem">
<div>Menu Item 7</div>
<div class="count">2</div>
</div>
</div>
</body>
</html>
I hope this code will be useful to you.
Thank you.
this is your code. What exactly is the problem? looks good from here.
btnfuc = () => {
document.getElementById('btn').style.backgroundColor = 'red';
};
btnf = () => {
document.getElementById('btn').style.backgroundColor = 'blueviolet';
};
* {
margin: 0;
padding: 0;
}
/* Header section start from here */
header {
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
background-color: black;
overflow: auto;
}
header .header-left {
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
flex-basis: 50%;
}
header .logo {
border-radius: 50%;
margin: 10px;
}
.header-left a {
text-decoration: none;
color: white;
}
header a:hover {
color: grey;
}
.header-right {
display: flex;
justify-content: flex-end;
align-items: center;
}
.header-right a {
margin: 10px;
font-size: 20px;
text-transform: uppercase;
text-decoration: none;
color: white;
padding: 10px;
}
.header-right a:hover {
color: black;
background-color: yellowgreen;
}
/* Header section end */
/* Container and after that about hasan section */
.container {
width: 90%;
margin: auto;
}
#about {
display: flex;
justify-content: space-between;
align-items: center;
margin: 25px;
}
.aboutText {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
section .aboutImg {
width: 500px;
height: auto;
border-radius: 10px;
}
section .aboutText {
width: 50%;
}
#about h1 {
font-size: 50px;
text-align: center;
margin-bottom: 15px;
}
#about p {
font-size: 18px;
font-style: italic;
}
#about button {
padding: 10px 30px;
background-color: rgb(61, 61, 230);
margin: 25px auto;
font-size: 18px;
}
/* About section end */
/* Gallery section starts */
#gallery h1 {
font-size: 50px;
text-align: center;
margin: 25px 0;
}
#gallery p {
font-size: 18px;
font-style: italic;
text-align: center;
margin: 25px 0;
}
section .flex {
display: flex;
justify-content: center;
align-items: center;
}
.flex img {
margin: 5px;
width: 300px;
height: 300px;
border: 2px solid black;
border-radius: 5px;
}
.flex img:nth-child(3) {
transform: rotate(-90deg);
}
/* Gallery section end */
/* Contact us page */
#contact h1 {
font-size: 50px;
text-align: center;
margin: 25px 0;
}
#contact p {
font-size: 18px;
font-style: italic;
text-align: center;
margin: 25px 0;
}
#contact img {
width: 50px;
height: auto;
position: relative;
top: 13px;
}
#contact a {
text-decoration: none;
color: rgb(70, 21, 21);
}
#contact a:hover {
color: green;
}
/* now the last foooter area */
footer {
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
background-color: black;
}
footer em {
color: white;
font-size: 15px;
padding: 30px;
}
footer img {
width: 30px;
height: auto;
position: relative;
top: 5px;
}
footer a {
color: white;
text-decoration: none;
}
footer a:hover {
color: green;
}
/* end for computers and now media queries */
#media screen and (max-width: 1200px) {
header {
flex-direction: column;
justify-content: center;
/* align-items: center; */
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Md Hasan</title>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="style.css" />
</head>
<body>
<header class="header">
<div class="header-left">
<a href="#"
><img
class="logo"
src="gallery/received_344045126587298.jpeg"
width="100px"
height="70px"
alt="logo"
/>
</a>
<a href="#">
<h1>Md Hasan</h1>
</a>
</div>
<div class="header-right">
Contact
Gallery
</div>
</header>
<div class="container">
<section id="about">
<div class="aboutText">
<div class="f1">
<h1>Who Is Hasan</h1>
<p>
Hasan is a Business man. He runs a Rubber Factory. He is a Good
person with a kind Heart. This website is just a gift for him
</p>
</div>
<div class="f2">
<a
href="https://www.facebook.com/messages/t/100011445344575"
target="_blank"
><button id="btn" onmouseout="btnf()" onmouseover="btnfuc()">
DM Hasan on FB
</button></a
>
</div>
</div>
<div class="aboutImg">
<img src="gallery/hasan.jpg" alt="About Hasan" class="aboutImg" />
</div>
</section>
<hr />
<section id="gallery">
<h1>Gallery</h1>
<p>Here you can see some rare pictures of Living Legend Md Hasan</p>
<div class="flex">
<img src="gallery/IMG20180305171539.jpg" alt="" />
<img src="gallery/IMG20180616172814.jpg" alt="" />
<img class="im3" src="gallery/IMG_20190404_201412.jpg" alt="" />
</div>
</section>
<hr />
<section id="contact">
<h1>Contact Us</h1>
<p>
<i>Need Hasan's Facebook Id? ok here you go.</i>
<a href="https://www.facebook.com/profile.php?id=100011445344575">
<img
class="fbLogo"
src="gallery/Facebook-logo-768x538.png"
alt="fb-link"
/>
Md Hasan
</a>
</p>
</section>
</div>
<footer class="footer">
<em class="em1"
>Created by - Ahmed Rafin | I'm a professional. Please give me Job.</em
>
<em class="em2">
<a href="https://facebook.com/psycho.rafin"
>Contact Me on
<img
class="fbLogo"
src="gallery/Facebook-logo-768x538.png"
alt="" /></a
></em>
</footer>
</body>
</html>

menu disappear when hover the list item

when i hover over the hamburger icon in 1000px mode the menu appears, but when i hover over menu it disappears. i have tried z-index and tricks related to position but cannot get the solution.
the issue is in 1000px because in full screen mode i can hover over sub-menu, but not on 1000px screen.
please help, thank you.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ESPN</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="./app.css">
</head>
<body>
<header class="header">
<div class="header__logo"><span>ESPN</span> / Media Distribution</div>
<div class="hamburger__icon__section">
</div>
<nav class="navbar">
<div class="navbar__items">
<div class="hamburger__icon"><div></div><div></div><div></div></div>
<ul class="navbar__lists__items">
<li class="navbar__hover__items">
Sports Programming
<ul class="navbar__lists__items__item">
<li>Boxing</li>
<li>Films</li>
<li>Fina</li>
<li>World Athletics</li>
<li>Ncaa</li>
<li>Pocker</li>
<li>Special Olympics</li>
<li>X Games</li>
</ul>
</li>
<li class="navbar__hover__items">Content Calender</li>
<li class="navbar__hover__items">
Contacts
<ul class="navbar__lists__items__item">
<li>Asia Pacific</li>
<li>Canada</li>
<li>Europe, Middle East and Africa</li>
<li>Latin America</li>
<li>Mexico</li>
</ul>
</li>
</ul>
<div class="search">
<input type="text" placeholder="Search">
<i class="fa fa-search"></i>
</input>
</div>
</div>
</nav>
</header>
<div class="video__section">
<div class="video__header__wrapper">
<video src="./6. Exercise Higher Order Functions.mp4" loop="true" autoplay="true" muted>
</video>
</div>
<div class="video__section__content">
<p><span>ESPN /</span> Media Distribution</p>
</div>
</div>
<div class="image__section">
<div class="image">
<img src="./food.png" alt="">
<div class="overlay"></div>
</div>
<div class="image">
<img src="./food.png" alt="">
<div class="overlay"></div>
</div>
<div class="image">
<img src="./food.png" alt="">
<div class="overlay"></div>
</div>
<div class="image">
<img src="./food.png" alt="">
<div class="overlay"></div>
</div>
<div class="image">
<img src="./food.png" alt="">
<div class="overlay"></div>
</div>
<div class="image">
<img src="./food.png" alt="">
<div class="overlay"></div>
</div>
<div class="image">
<img src="./food.png" alt="">
<div class="overlay"></div>
</div>
<div class="image">
<img src="./food.png" alt="">
<div class="overlay"></div>
</div>
</div>
<div class="copyright__section">
<div class="copyright__section__content">
<p>Copyright © 2020 ESPN, Inc. - All Rights Reserved | Terms of Use | Privacy Policy</p>
</div>
</div>
</body>
</html>
#import url('https://fonts.googleapis.com/css2?family=Fira+Sans:wght#600&display=swap');
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
font-family: 'Fira Sans', sans-serif;
line-height: 1.6rem;
}
body {
font-size: 1.6rem;
}
.header {
display: flex;
justify-content: space-around;
align-items: stretch;
background-color:rgb(202, 8, 19);
color: #fff;
border-bottom: 1px solid #fff;
}
.header__logo {
font-size: 20px;
line-height: 50px;
user-select: none;
}
.header__logo span {
font-style: oblique;
}
.navbar__items {
display: flex;
justify-content: center;
align-items: stretch;
}
.navbar__lists__items {
display: flex;
justify-content: center;
align-items: stretch;
list-style: none;
}
.navbar__lists__items > li {
margin: 0 5px;
}
.navbar__lists__items__item {
width: 250px;
opacity: 0;
pointer-events: none;
position: absolute;
top: 59px;
left: 0px;
right: 0;
list-style: none;
transition: all 0.3s;
}
.navbar__lists__items__item li {
cursor: pointer;
border: 1px solid #666;
background-color: #fff;
line-height: 1.6rem;
}
.navbar__lists__items__item li a:hover {
background-color: #666666;
color: #fff;
}
.navbar__lists__items__item li a {
padding: 10px 20px;
display: block;
text-decoration: none;
color: #666666;
text-transform: uppercase;
}
.navbar__hover__items {
display: flex;
justify-content: center;
align-items: stretch;
position: relative;
line-height: 50px;
z-index: 1;
}
.navbar__hover__items > a {
margin-right: 5px;
}
.navbar__lists__items .navbar__hover__items:nth-child(odd)::after {
content: ' \02C5';
}
.navbar__lists__items > li > a {
text-decoration: none;
color: #fff;
text-transform: uppercase;
}
.navbar__hover__items:nth-child(2n+1):hover > a {
background-color: #fff;
color: rgb(202, 8, 19);
}
.navbar__hover__items:nth-child(2n+1):hover .navbar__lists__items__item {
opacity: 1;
pointer-events: all;
transform: translateY(-10px);
}
.search {
position: relative;
display: flex;
justify-content: center;
align-items: center;
}
.search input {
border: 1px solid #fff;
outline: none;
border-radius: 5px;
padding: 5px;
}
.search i {
position: absolute;
color: #000;
top: 50%;
left: 95%;
transform: translate(-95%, -50%);
margin-right: -30px;
}
.video__section {
width: 100%;
height: 100%;
position: relative;
color: #fff;
font-size: 40px;
}
.video__header__wrapper {
width: 100%;
height: 100%;
}
.video__header__wrapper video {
width: 100%;
height: 100%;
}
.video__section__content {
position: absolute;
top: 40%;
left: 50%;
transform: translate(-50%, -40%);
user-select: none;
}
.video__section__content span {
font-style: oblique;
}
.image__section {
display: flex;
justify-content: center;
flex-wrap: wrap;
align-items: center;
}
.image__section .image {
flex-basis: 25%;
overflow: hidden;
position: relative;
height: 200px;
width: 150px;
}
.image__section .image img {
width: 100%;
height: 100%;
cursor: pointer;
transform: scale(1.1);
transition: all 0.3s;
}
.overlay {
position: absolute;
right: 0;
left: 0;
bottom: 100%;
background-color: #000;
width: 100%;
overflow: hidden;
opacity: 0.7;
transition: 0.3s ease;
}
.image:hover img {
transform: scale(1);
}
.image:hover > .overlay {
height: 100%;
bottom: 0;
}
.copyright__section {
font-size: 10px;
background-color: rgb(202, 8, 19);
color: #fff;
}
.copyright__section__content {
margin-top: 0;
margin-bottom: 0;
margin-left: 30px;
}
#media (max-width: 1000px) {
.header {
padding: 0 10px;
}
.navbar__items {
position: relative;
}
.navbar__lists__items {
display: none;
position: absolute;
top: 50px;
right: 50px;
width: 300px;
padding: 0 10px;
background-color: #fff;
font-family: 'Lato',Helvetica,Arial,Lucida,sans-serif;
z-index: 1;
box-shadow: 0 0 0.5px 1px rgb(255, 255, 255, 0.7);
}
.navbar__lists__items > li > a {
color: #000;
}
.navbar__lists__items .navbar__hover__items:nth-child(odd)::after {
content: "";
display: block;
}
.navbar__hover__items {
display: block;
color: #000;
}
.navbar__lists__items__item {
display: none;
}
.video__section {
font-size: 35px;
}
.search {
height: 50px;
}
.hamburger__icon__section {
display: flex;
justify-content: flex-end;
flex: 2;
}
.hamburger__icon {
display: flex;
flex-direction: column;
justify-content: center;
align-items: flex-end;
margin-right: 10px;
cursor: pointer;
}
.hamburger__icon > div {
width: 25px;
height: 2px;
margin: 3px 0;
background-color: #fff;
}
.hamburger__icon:hover + .navbar__lists__items {
display: block;
}
}
You could handle the show/hide using javascript instead of css because the way you do it right now whenever the browser detects your cursor is no longer on top of the hamburger_buttton it will hide your menu so it would be better to handle the event with a click instead. Or you can check this answer. Hope it helps.
let navbarListItems = document.querySelector('.navbar__lists__items');
let hamburgetButton = document.querySelector('.hamburger__icon');
hamburgetButton.onclick = function () {
navbarListItems.style.display = navbarListItems.style.display === 'none' ? 'block' : 'none';
}
#import url('https://fonts.googleapis.com/css2?family=Fira+Sans:wght#600&display=swap');
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
font-family: 'Fira Sans', sans-serif;
line-height: 1.6rem;
}
body {
font-size: 1.6rem;
}
.header {
display: flex;
justify-content: space-around;
align-items: stretch;
background-color: rgb(202, 8, 19);
color: #fff;
border-bottom: 1px solid #fff;
}
.header__logo {
font-size: 20px;
line-height: 50px;
user-select: none;
}
.header__logo span {
font-style: oblique;
}
.navbar__items {
display: flex;
justify-content: center;
align-items: stretch;
}
.navbar__lists__items {
display: flex;
justify-content: center;
align-items: stretch;
list-style: none;
}
.navbar__lists__items>li {
margin: 0 5px;
}
.navbar__lists__items__item {
width: 250px;
opacity: 0;
pointer-events: none;
position: absolute;
top: 59px;
left: 0px;
right: 0;
list-style: none;
transition: all 0.3s;
}
.navbar__lists__items__item li {
cursor: pointer;
border: 1px solid #666;
background-color: #fff;
line-height: 1.6rem;
}
.navbar__lists__items__item li a:hover {
background-color: #666666;
color: #fff;
}
.navbar__lists__items__item li a {
padding: 10px 20px;
display: block;
text-decoration: none;
color: #666666;
text-transform: uppercase;
}
.navbar__hover__items {
display: flex;
justify-content: center;
align-items: stretch;
position: relative;
line-height: 50px;
z-index: 1;
}
.navbar__hover__items>a {
margin-right: 5px;
}
.navbar__lists__items .navbar__hover__items:nth-child(odd)::after {
content: ' \02C5';
}
.navbar__lists__items>li>a {
text-decoration: none;
color: #fff;
text-transform: uppercase;
}
.navbar__hover__items:nth-child(2n+1):hover>a {
background-color: #fff;
color: rgb(202, 8, 19);
}
.navbar__hover__items:nth-child(2n+1):hover .navbar__lists__items__item {
opacity: 1;
pointer-events: all;
transform: translateY(-10px);
}
.search {
position: relative;
display: flex;
justify-content: center;
align-items: center;
}
.search input {
border: 1px solid #fff;
outline: none;
border-radius: 5px;
padding: 5px;
}
.search i {
position: absolute;
color: #000;
top: 50%;
left: 95%;
transform: translate(-95%, -50%);
margin-right: -30px;
}
.video__section {
width: 100%;
height: 100%;
position: relative;
color: #fff;
font-size: 40px;
}
.video__header__wrapper {
width: 100%;
height: 100%;
}
.video__header__wrapper video {
width: 100%;
height: 100%;
}
.video__section__content {
position: absolute;
top: 40%;
left: 50%;
transform: translate(-50%, -40%);
user-select: none;
}
.video__section__content span {
font-style: oblique;
}
.image__section {
display: flex;
justify-content: center;
flex-wrap: wrap;
align-items: center;
}
.image__section .image {
flex-basis: 25%;
overflow: hidden;
position: relative;
height: 200px;
width: 150px;
}
.image__section .image img {
width: 100%;
height: 100%;
cursor: pointer;
transform: scale(1.1);
transition: all 0.3s;
}
.overlay {
position: absolute;
right: 0;
left: 0;
bottom: 100%;
background-color: #000;
width: 100%;
overflow: hidden;
opacity: 0.7;
transition: 0.3s ease;
}
.image:hover img {
transform: scale(1);
}
.image:hover>.overlay {
height: 100%;
bottom: 0;
}
.copyright__section {
font-size: 10px;
background-color: rgb(202, 8, 19);
color: #fff;
}
.copyright__section__content {
margin-top: 0;
margin-bottom: 0;
margin-left: 30px;
}
#media (max-width: 1000px) {
.header {
padding: 0 10px;
}
.navbar__items {
position: relative;
}
.navbar__lists__items {
display: none;
position: absolute;
top: 50px;
right: 50px;
width: 300px;
padding: 0 10px;
background-color: #fff;
font-family: 'Lato', Helvetica, Arial, Lucida, sans-serif;
z-index: 1;
box-shadow: 0 0 0.5px 1px rgb(255, 255, 255, 0.7);
}
.navbar__lists__items>li>a {
color: #000;
}
.navbar__lists__items .navbar__hover__items:nth-child(odd)::after {
content: "";
display: block;
}
.navbar__hover__items {
display: block;
color: #000;
}
.navbar__lists__items__item {
display: none;
}
.video__section {
font-size: 35px;
}
.search {
height: 50px;
}
.hamburger__icon__section {
display: flex;
justify-content: flex-end;
flex: 2;
}
.hamburger__icon {
display: flex;
flex-direction: column;
justify-content: center;
align-items: flex-end;
margin-right: 10px;
cursor: pointer;
}
.hamburger__icon>div {
width: 25px;
height: 2px;
margin: 3px 0;
background-color: #fff;
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ESPN</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="./app.css">
</head>
<body>
<header class="header">
<div class="header__logo"><span>ESPN</span> / Media Distribution</div>
<div class="hamburger__icon__section">
</div>
<nav class="navbar">
<div class="navbar__items">
<div class="hamburger__icon">
<div></div>
<div></div>
<div></div>
</div>
<ul class="navbar__lists__items">
<li class="navbar__hover__items">
Sports Programming
<ul class="navbar__lists__items__item">
<li>Boxing</li>
<li>Films</li>
<li>Fina</li>
<li>World Athletics</li>
<li>Ncaa</li>
<li>Pocker</li>
<li>Special Olympics</li>
<li>X Games</li>
</ul>
</li>
<li class="navbar__hover__items">Content Calender</li>
<li class="navbar__hover__items">
Contacts
<ul class="navbar__lists__items__item">
<li>Asia Pacific</li>
<li>Canada</li>
<li>Europe, Middle East and Africa</li>
<li>Latin America</li>
<li>Mexico</li>
</ul>
</li>
</ul>
<div class="search">
<input type="text" placeholder="Search">
<i class="fa fa-search"></i>
</input>
</div>
</div>
</nav>
</header>
<div class="video__section">
<div class="video__header__wrapper">
<video src="./6. Exercise Higher Order Functions.mp4" loop="true" autoplay="true" muted>
</video>
</div>
<div class="video__section__content">
<p><span>ESPN /</span> Media Distribution</p>
</div>
</div>
<div class="image__section">
<div class="image">
<img src="./food.png" alt="">
<div class="overlay"></div>
</div>
<div class="image">
<img src="./food.png" alt="">
<div class="overlay"></div>
</div>
<div class="image">
<img src="./food.png" alt="">
<div class="overlay"></div>
</div>
<div class="image">
<img src="./food.png" alt="">
<div class="overlay"></div>
</div>
<div class="image">
<img src="./food.png" alt="">
<div class="overlay"></div>
</div>
<div class="image">
<img src="./food.png" alt="">
<div class="overlay"></div>
</div>
<div class="image">
<img src="./food.png" alt="">
<div class="overlay"></div>
</div>
<div class="image">
<img src="./food.png" alt="">
<div class="overlay"></div>
</div>
</div>
<div class="copyright__section">
<div class="copyright__section__content">
<p>Copyright © 2020 ESPN, Inc. - All Rights Reserved | Terms of Use | Privacy Policy</p>
</div>
</div>
</body>
</html>
Simply add this to your selector :
, .navbar__lists__items:hover
The full rule should look like this :
.hamburger__icon:hover + .navbar__lists__items, .navbar__lists__items:hover {
display: block;
}
This is happening since the scope of hover effect is only limited to the hamburger icon and as soon as the hover scope is left, the css does not execute for it so in order to stabilize the menu items I have added hover scope to that <ul> too.
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html {
font-size: 62.5%;
font-family: 'Fira Sans', sans-serif;
line-height: 1.6rem;
}
body {
font-size: 1.6rem;
}
.header {
display: flex;
justify-content: space-around;
align-items: stretch;
background-color:rgb(202, 8, 19);
color: #fff;
border-bottom: 1px solid #fff;
}
.header__logo {
font-size: 20px;
line-height: 50px;
user-select: none;
}
.header__logo span {
font-style: oblique;
}
.navbar__items {
display: flex;
justify-content: center;
align-items: stretch;
}
.navbar__lists__items {
display: flex;
justify-content: center;
align-items: stretch;
list-style: none;
}
.navbar__lists__items > li {
margin: 0 5px;
}
.navbar__lists__items__item {
width: 250px;
opacity: 0;
pointer-events: none;
position: absolute;
top: 59px;
left: 0px;
right: 0;
list-style: none;
transition: all 0.3s;
}
.navbar__lists__items__item li {
cursor: pointer;
border: 1px solid #666;
background-color: #fff;
line-height: 1.6rem;
}
.navbar__lists__items__item li a:hover {
background-color: #666666;
color: #fff;
}
.navbar__lists__items__item li a {
padding: 10px 20px;
display: block;
text-decoration: none;
color: #666666;
text-transform: uppercase;
}
.navbar__hover__items {
display: flex;
justify-content: center;
align-items: stretch;
position: relative;
line-height: 50px;
z-index: 1;
}
.navbar__hover__items > a {
margin-right: 5px;
}
.navbar__lists__items .navbar__hover__items:nth-child(odd)::after {
content: ' \02C5';
}
.navbar__lists__items > li > a {
text-decoration: none;
color: #fff;
text-transform: uppercase;
}
.navbar__hover__items:nth-child(2n+1):hover > a {
background-color: #fff;
color: rgb(202, 8, 19);
}
.navbar__hover__items:nth-child(2n+1):hover .navbar__lists__items__item {
opacity: 1;
pointer-events: all;
transform: translateY(-10px);
}
.search {
position: relative;
display: flex;
justify-content: center;
align-items: center;
}
.search input {
border: 1px solid #fff;
outline: none;
border-radius: 5px;
padding: 5px;
}
.search i {
position: absolute;
color: #000;
top: 50%;
left: 95%;
transform: translate(-95%, -50%);
margin-right: -30px;
}
.video__section {
width: 100%;
height: 100%;
position: relative;
color: #fff;
font-size: 40px;
}
.video__header__wrapper {
width: 100%;
height: 100%;
}
.video__header__wrapper video {
width: 100%;
height: 100%;
}
.video__section__content {
position: absolute;
top: 40%;
left: 50%;
transform: translate(-50%, -40%);
user-select: none;
}
.video__section__content span {
font-style: oblique;
}
.image__section {
display: flex;
justify-content: center;
flex-wrap: wrap;
align-items: center;
}
.image__section .image {
flex-basis: 25%;
overflow: hidden;
position: relative;
height: 200px;
width: 150px;
}
.image__section .image img {
width: 100%;
height: 100%;
cursor: pointer;
transform: scale(1.1);
transition: all 0.3s;
}
.overlay {
position: absolute;
right: 0;
left: 0;
bottom: 100%;
background-color: #000;
width: 100%;
overflow: hidden;
opacity: 0.7;
transition: 0.3s ease;
}
.image:hover img {
transform: scale(1);
}
.image:hover > .overlay {
height: 100%;
bottom: 0;
}
.copyright__section {
font-size: 10px;
background-color: rgb(202, 8, 19);
color: #fff;
}
.copyright__section__content {
margin-top: 0;
margin-bottom: 0;
margin-left: 30px;
}
#media (max-width: 1000px) {
.header {
padding: 0 10px;
}
.navbar__items {
position: relative;
}
.navbar__lists__items {
display: none;
position: absolute;
top: 50px;
right: 50px;
width: 300px;
padding: 0 10px;
background-color: #fff;
font-family: 'Lato',Helvetica,Arial,Lucida,sans-serif;
z-index: 1;
box-shadow: 0 0 0.5px 1px rgb(255, 255, 255, 0.7);
}
.navbar__lists__items > li > a {
color: #000;
}
.navbar__lists__items .navbar__hover__items:nth-child(odd)::after {
content: "";
display: block;
}
.navbar__hover__items {
display: block;
color: #000;
}
.navbar__lists__items__item {
display: none;
}
.video__section {
font-size: 35px;
}
.search {
height: 50px;
}
.hamburger__icon__section {
display: flex;
justify-content: flex-end;
flex: 2;
}
.hamburger__icon {
display: flex;
flex-direction: column;
justify-content: center;
align-items: flex-end;
margin-right: 10px;
cursor: pointer;
}
.hamburger__icon > div {
width: 25px;
height: 2px;
margin: 3px 0;
background-color: #fff;
}
/* added another line here */
.hamburger__icon:hover + .navbar__lists__items,
.hamburger__icon + .navbar__lists__items:hover{
display: block;
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ESPN</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="./app.css">
</head>
<body>
<header class="header">
<div class="header__logo"><span>ESPN</span> / Media Distribution</div>
<div class="hamburger__icon__section">
</div>
<nav class="navbar">
<div class="navbar__items">
<div class="hamburger__icon"><div></div><div></div><div></div></div>
<ul class="navbar__lists__items">
<li class="navbar__hover__items">
Sports Programming
<ul class="navbar__lists__items__item">
<li>Boxing</li>
<li>Films</li>
<li>Fina</li>
<li>World Athletics</li>
<li>Ncaa</li>
<li>Pocker</li>
<li>Special Olympics</li>
<li>X Games</li>
</ul>
</li>
<li class="navbar__hover__items">Content Calender</li>
<li class="navbar__hover__items">
Contacts
<ul class="navbar__lists__items__item">
<li>Asia Pacific</li>
<li>Canada</li>
<li>Europe, Middle East and Africa</li>
<li>Latin America</li>
<li>Mexico</li>
</ul>
</li>
</ul>
<div class="search">
<input type="text" placeholder="Search">
<i class="fa fa-search"></i>
</input>
</div>
</div>
</nav>
</header>
<div class="video__section">
<div class="video__header__wrapper">
<video src="./6. Exercise Higher Order Functions.mp4" loop="true" autoplay="true" muted>
</video>
</div>
<div class="video__section__content">
<p><span>ESPN /</span> Media Distribution</p>
</div>
</div>
<div class="image__section">
<div class="image">
<img src="./food.png" alt="">
<div class="overlay"></div>
</div>
<div class="image">
<img src="./food.png" alt="">
<div class="overlay"></div>
</div>
<div class="image">
<img src="./food.png" alt="">
<div class="overlay"></div>
</div>
<div class="image">
<img src="./food.png" alt="">
<div class="overlay"></div>
</div>
<div class="image">
<img src="./food.png" alt="">
<div class="overlay"></div>
</div>
<div class="image">
<img src="./food.png" alt="">
<div class="overlay"></div>
</div>
<div class="image">
<img src="./food.png" alt="">
<div class="overlay"></div>
</div>
<div class="image">
<img src="./food.png" alt="">
<div class="overlay"></div>
</div>
</div>
<div class="copyright__section">
<div class="copyright__section__content">
<p>Copyright © 2020 ESPN, Inc. - All Rights Reserved | Terms of Use | Privacy Policy</p>
</div>
</div>
</body>
</html>

Resources