How to make my navigation bar menu button work? - html

i dont know why my button dont show the menu when clicked ;
i try almost everything i know, but i cant define my problem.
i use the "checkbox" trick to show the hamburger button when the site go under 500 px to show a resposive menu but i dont know w
i searched on google and youtube mìbut nothing i can help me put
HTML
<header>
<ul>
<!-- ho aggiunto checkbox,toggle(bottone menu, id carrellore(carrello che compare con la mediaquery -->
<input type="checkbox" id="toggle"/>
<p id="carrellore"><img src="./images/carrello.png"></p>
<label for="toggle">☰</label>
<!-- ho aggiunto checkbox,toggle(bottone menu, id carrellore(carrello che compare con la mediaquery -->
<li>HOME<li>
<li>CATALOGO<li>
<% if ((session.getAttribute("login_result")!=null) && ((Boolean)(session.getAttribute("login_result")))) {%>
<li>PROFILO<li>
<%} else { %>
LOGIN<li>
<%} %>
<li id="carrello"><img src="./images/carrello.png"></li>
</ul>
<div id="spazio">Spazio libero<br><br></div>
</header>
CSS
header ul {
list-style-type: none;
margin: 0;
padding: 0;
background-color: #000000;
width: 100%;
position: fixed;
top: 0;
left: 0;
}
header li {
float: left;
}
header li a {
display: block;
text-decoration: none;
color: white;
padding: 15px 15px;
font-family: "Lato", sans-serif;
}
header li a:hover {
background-color: #0080ff;
}
label {
margin: 0 40px 0 0;
font-size: 30px;
line-height: 70px;
display: none;
width: 14px;
float: center;
color: #ffffff;
}
#toggle {
display:none;
}
#carrello {
float: right;
}
#carrello img {
height: 18px;
width: auto;
object-fit: contain;
}
#carrellore {
float:right;
display:none;
}
#carrellore img {
height: 30px;
width: auto;
object-fit: contain;
}
#spazio {
margin-top: 25px;
visibility: hidden;
}
#logo {
display: block;
margin: auto;
}
/* mediaquery per rendere il sito responsive */
#media only screen and (max-width: 500px) {
#spazio {
margin-top: 50px;
visibility: hidden;
}
#carrellore {
display: block;
cursor: pointer;
}
label {
display: block;
cursor: pointer;
float: center;
}
header li {
background-color: #000000;
color: white;
text-align: center;
width: 100%;
display: none;
}
header li a {
background-color: #000000;
display: block;
border-bottom: 1px solid #EAEAEB;
margin: 0;
}
#toggle:checked + header li a {
display:block ;
}
“I’m setting up a new server, and want to support UTF-8 fully in my web application. Where do I need to set the encoding/charsets?”
}
the button dont trigger at all but the checkbox check

Try this code..
HTML
<header>
<ul>
<input type="checkbox" id="toggle"/>
<p id="carrellore"><img src="./images/carrello.png"></p>
<label for="toggle">☰</label>
<ul class="menu">
<li>HOME<li>
<li>CATALOGO<li>
<% if ((session.getAttribute("login_result")!=null) && ((Boolean)(session.getAttribute("login_result")))) {%>
<li>PROFILO<li>
<%} else { %>
LOGIN<li>
<%} %>
<li id="carrello"><img src="./images/carrello.png"></li>
</ul>
<div id="spazio">Spazio libero<br><br></div>
</header>
**CSS**
header ul {
list-style-type: none;
margin: 0;
padding: 0;
background-color: #000000;
width: 100%;
position: fixed;
top: 0;
left: 0;
}
header li {
float: left;
}
header li a {
display: block;
text-decoration: none;
color: white;
padding: 15px 15px;
font-family: "Lato", sans-serif;
}
header li a:hover {
background-color: #0080ff;
}
label {
margin: 0 40px 0 0;
font-size: 30px;
line-height: 70px;
display: none;
width: 14px;
float: center;
color: #ffffff;
}
#toggle {
display:none;
}
#carrello {
float: right;
}
#carrello img {
height: 18px;
width: auto;
object-fit: contain;
}
#carrellore {
float:right;
display:none;
}
#carrellore img {
height: 30px;
width: auto;
object-fit: contain;
}
header {
padding-top: 66px;
}
body {
margin: 0px;
}
#logo {
display: block;
margin: auto;
}
/* mediaquery per rendere il sito responsive */
#media only screen and (max-width: 500px) {
#spazio {
margin-top: 50px;
visibility: hidden;
}
#carrellore {
display: block;
cursor: pointer;
}
label {
display: block;
cursor: pointer;
float: center;
}
header ul.menu {
display: none;
}
header li {
background-color: #000000;
color: white;
text-align: center;
width: 100%;
}
header li a {
background-color: #000000;
display: block;
border-bottom: 1px solid #EAEAEB;
margin: 0;
}
#toggle:checked + header li a {
display:block ;
}
}
JQUERY
<script type="text/javascript">
$('body').on('click','label',function() {
$('.menu').slideToggle();
});
</script>

Related

Why isn't my menu transition being applied?

I am trying to create a navbar but the animation are not working, As you can see, I have put position: fixed; and right: -100%; to the .nav-links so that it can hide and not create white space at the right and #nav-btn:checked~.nav-links { right: 0; width: 100% !important; }
And when I click at the checkbox it does not show the animation and appear without any animation and that's my problem.
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
margin: 0;
padding: 0;
}
nav {
background: black;
width: 100% !important;
color: white;
height: 76px;
line-height: 76px;
padding-right: 10px;
font-size: 20pt !important;
}
.nav-links a {
font-size: 20px;
text-decoration: none;
}
#nav-btn,
label {
display: none;
}
#media(min-width: 600px) {
label {}
.nav-links a {
color: white;
}
.nav-links {
float: right;
justify-content: space-between;
}
.nav-links a:hover {
background-color: white;
color: black;
padding-top: 2.5px;
padding-bottom: 2.5px;
border-radius: 5px;
padding-right: 2.5px;
padding-left: 2.5px;
}
.title,
.nav-links {
display: inline;
}
}
#media(max-width: 599px) {
.nav-links {
background-color: black;
}
label {
display: inline;
float: right;
padding-right: 20px;
}
.extra {
display: none;
}
.nav-links {
text-align: center;
display: block;
}
.nav-links a {
display: block;
transition: .9s;
}
nav {
padding-right: 0px;
}
.nav-links a:hover,
.active {
background: #ff000a;
color: white;
}
a {
text-decoration: none;
color: white;
}
.nav-links {
position: fixed;
right: -100%;
}
#nav-btn:checked~.nav-links {
right: 0;
width: 100% !important;
}
}
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="https://kit.fontawesome.com/e8f9edfb9f.js" crossorigin="anonymous"></script>
</head>
<body>
<nav>
⠀<span class="title">Nav</span>
<label for="nav-btn"><i class="fas fa-bars"></i></label>
<input type="checkbox" name="" id="nav-btn">
<div class="nav-links">
Home
About
Contact Us
Feedback
</div>
</nav>
</body>
If I understand correctly, you need to put the transition on the nav links container, not the links. That's where the open/close happens.
I've also moved your width rule to the container for all states, not just when it's shown. That fixes the close transition.
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
margin: 0;
padding: 0;
}
nav {
background: black;
width: 100% !important;
color: white;
height: 76px;
line-height: 76px;
padding-right: 10px;
font-size: 20pt !important;
}
.nav-links a {
font-size: 20px;
text-decoration: none;
}
#nav-btn,
label {
display: none;
}
#media(max-width: 9599px) {
.nav-links {
background-color: black;
transition: .9s;
text-align: center;
display: block;
width: 100%;
}
label {
display: inline;
float: right;
padding-right: 20px;
}
.extra {
display: none;
}
.nav-links a {
display: block;
}
nav {
padding-right: 0px;
}
.nav-links a:hover,
.active {
background: #ff000a;
color: white;
}
a {
text-decoration: none;
color: white;
}
.nav-links {
position: fixed;
right: -100%;
}
#nav-btn:checked~.nav-links {
right: 0;
}
}
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="https://kit.fontawesome.com/e8f9edfb9f.js" crossorigin="anonymous"></script>
</head>
<body>
<nav>
⠀<span class="title">Nav</span>
<label for="nav-btn"><i class="fas fa-bars"></i></label>
<input type="checkbox" name="" id="nav-btn">
<div class="nav-links">
Home
About
Contact Us
Feedback
</div>
</nav>
</body>

How do I position a side section or div in relation to nav bar?

I have the layout as below:
https://imgur.com/r1l0cCi
I have added a side section just below the nav bar. I want the side section to be placed in relation to the nav bar but it takes its position in relation to the header. Is there a way I can achieve this?
Here is my html code and css
body {
position: absolute;
top: 0px;
left: 0px;
right: 0px;
bottom: 0px;
}
.header {
border-radius: 25px;
height: 14%;
width: 100%;
}
img.nav-action-image {
width: 14px;
height: auto;
}
nav a {
display: inline;
text-decoration: none;
float: left;
color: #d1e231;
padding: 14px 16px;
border-right: 1px solid #bbb;
}
nav a:hover {
color: #bff000;
}
nav a.active {
display: inline;
background-color: #bab86c;
color: #37412a;
}
.navigation-bar {
position: absolute;
padding: 0;
width: 100%;
margin-top: 5px;
border-radius: 7px;
}
.action-block {
height: 80%;
width: 20%;
margin-top: 40px;
}
<body>
<header class=header>
</header>
<nav class=navigation-bar>
<img class="nav-action-image" src="menu_icon.png" />
<a class="active" href="#Summary">Summary</a>
Preferences
</nav>
<br>
<div class="action-block">
hello
</div>
</body>
you can see that in the css, the code for action-block class aligns from the header instead of the nav bar. I want it to align from the nav bar. Is there a way that I can do this?
remove position:absolute from body and nav.
The below css will clear the floating elements inside nav which will give it a height of its content.
nav:after {
content: '';
display: block;
clear: both
}
html,
body {
height: 100%
}
.header {
border-radius: 25px;
height: 14%;
width: 100%;
}
img.nav-action-image {
width: 14px;
height: auto;
}
nav:after {
content: '';
display: block;
clear: both
}
nav a {
display: inline;
text-decoration: none;
float: left;
color: #d1e231;
padding: 14px 16px;
border-right: 1px solid #bbb;
}
nav a:hover {
color: #bff000;
}
nav a.active {
display: inline;
background-color: #bab86c;
color: #37412a;
}
.navigation-bar {
padding: 0;
width: 100%;
margin-top: 5px;
border-radius: 7px;
background: yellow;
}
.action-block {
height: 80%;
width: 20%;
background: greenyellow;
}
<body>
<header class="header">
</header>
<nav class="navigation-bar">
<img class="nav-action-image" src="menu_icon.png" />
<a class="active" href="#Summary">Summary</a>
Preferences
</nav>
<div class="action-block">
hello
</div>
</body>
If using a absolute element relative to another element, then the parent must have position: relative. With this in mind replace your body css with:
html, body {
width: 100%;
height: 100%;
margin: 0;
position: relative;
}
If using floats in the nav (the anchor element), use a clear: both at the end likte this
.navigation-bar {
position: absolute;
display: block;
width: 100%;
margin-top: 5px;
padding: 0;
border-radius: 7px;
}
.navigation-bar::after {
display: block;
clear: both;
content: "";
}
nav a {
float: left;
padding: 14px 16px;
text-decoration: none;
color: #d1e231;
}
nav a:hover {
color: #bff000;
}
nav a.active {
background-color: #bab86c;
color: #37412a;
}

adding my logo in my navigation

I'm currently studying web development so I'm practising some html and css.
I'm having problems placing my logo on the left.
what I wish to accomplish is something like this:
prototype navigation
I have a logo on the left side of my navigation bar and on my right is my navigation menus home, partners and products that turns into a hamburger menu when the width of the screen decreases.
Can you please help me out or point me to a good resource to get my layouts properly done? thank you all in advance.
Here is my HTML code:
.menu {
margin: 0 30px 0 0;
background-color: #f8f5f2;
overflow: hidden;
position: fixed;
top: 0;
width: 100%;
}
.menu a {
text-decoration: none;
color:black;
margin: 0 10px;
line-height: 70px;
font-family: playfair-display
}
span {
color: dodgerblue;
}
label {
margin: 0 40px 0 0;
font-size: 26px;
line-height: 70px;
display: none;
width: 20px;
float: right;
}
#toggle {
display: none;
}
#media only screen and (max-width: 500px) {
label{
display: block;
cursor: pointer;
}
.menu {
text-align: center;
width: 100%;
display: none;
}
.menu a {
clear: right;
display: block;
border-bottom: 1px solid black;
margin: 0;
}
#toggle: checked + .menu {
display: block;
}
}
<header>
<div class="nav">
<div id="logo">
<img src="img/logoblackandred.png" alt="logo">
</div>
<label for="toggle">☰</label>
<input type="checkbox" id="toggle" />
<div class="menu">
Home
Partners
<span>Products</span>
</div>
</div>
</header>
Try
img{
display:inline;
width:70px;
height:50px;
float:left;
}
Like this?
I removed the position: fixed and added display: inline to #logo and #menu
.menu {
margin: 0 30px 0 0;
background-color: #f8f5f2;
overflow: hidden;
width: 100%;
display: inline;
}
.menu a
{
text-decoration: none;
color:black;
margin: 0 10px;
line-height: 70px;
font-family: playfair-display
}
span
{
color: dodgerblue;
}
label
{
margin: 0 40px 0 0;
font-size: 26px;
line-height: 70px;
display: none;
width: 20px;
float: right;
}
#toggle
{
display: none;
}
#logo {
display: inline;
}
#media only screen and (max-width: 500px)
{
label
{
display: block;
cursor: pointer;
}
.menu
{
text-align: center;
width: 100%;
display: none;
}
.menu a
{
clear: right;
display: block;
border-bottom: 1px solid black;
margin: 0;
}
#toggle: checked + .menu
{
display: block;
}
}
<header>
<div class="nav">
<div id="logo">
<img src="https://cdn.sstatic.net/Sites/stackoverflow/company/img/logos/so/so-logo.png?v=9c558ec15d8a" alt="logo" width="200px">
</div>
<label for="toggle">☰</label>
<input type="checkbox" id="toggle" />
<div class="menu">
Home
Partners
<span>Products</span>
</div>
</div>
</header>
I change Html code little , and added to css code a few line.
This is Demo
.menu
{
margin: 0 30px 0 0;
background-color: #f8f5f2;
overflow: hidden;
position: fixed;
top: 0;
width: 100%;
}
.menu a
{
text-decoration: none;
color:black;
margin: 0 10px;
line-height: 70px;
font-family: playfair-display
}
span
{
color: dodgerblue;
}
label
{
margin: 0 40px 0 0;
font-size: 26px;
line-height: 70px;
display: none;
width: 20px;
float: right;
}
#toggle
{
display: none;
}
.logo {
display: none;
}
.lg-logo {
float: left;
display: inline-block;
width: 50px;
margin-top: 15px;
}
#media only screen and (max-width: 500px)
{
label
{
display: inline-block;
cursor: pointer;
vertical-align: middle;
}
.menu
{
text-align: center;
width: 100%;
display: none;
}
.menu a
{
clear: right;
display: block;
border-bottom: 1px solid black;
margin: 0;
}
#toggle: checked + .menu
{
display: block;
}
.logo {
float: left;
display: inline-block;
width: 50px;
margin-top: 15px;
}
}
<header>
<div class="nav">
<div id="logo">
<img class="logo" src="http://pngimg.com/uploads/car_logo/car_logo_PNG1640.png" alt="logo">
</div>
<label for="toggle">☰</label>
<input type="checkbox" id="toggle" />
<div class="menu">
Home
Partners
<span>Products</span>
<img class="lg-logo" src="http://pngimg.com/uploads/car_logo/car_logo_PNG1640.png" alt="logo">
</div>
</div>
</header>
Note : Resize Browser and see result.
Try checking below code jsfiddle link.
You can change the width for logo id and menu class https://jsfiddle.net/pradeepv/yxnLs89h/
Please relpace this code with your old code.
.menu
{
margin: 0 30px 0 0;
background-color: #f8f5f2;
overflow: hidden;
position: fixed;
top: 0;
width: 100%;
}
.menu a
{
text-decoration: none;
color:black;
margin: 0 10px;
line-height: 70px;
font-family: playfair-display
}
span
{
color: dodgerblue;
}
label
{
margin: 0 40px 0 0;
font-size: 26px;
line-height: 70px;
display: none;
width: 20px;
float: right;
}
#toggle
{
display: none;
}
.logo {
display: none;
}
.lg-logo {
float: left;
display: inline-block;
width: 50px;
margin-top: 15px;
}
#media only screen and (max-width: 500px)
{
label
{
display: inline-block;
cursor: pointer;
vertical-align: middle;
}
.menu
{
text-align: center;
width: 100%;
display: none;
}
.menu a
{
clear: right;
display: block;
border-bottom: 1px solid black;
margin: 0;
}
#toggle: checked + .menu
{
display: block;
}
.logo {
float: left;
display: inline-block;
width: 50px;
margin-top: 15px;
}
}
<div class="nav">
<div id="logo">
<img class="logo" src="http://pngimg.com/uploads/car_logo/car_logo_PNG1640.png" alt="logo">
</div>
<label for="toggle">☰</label>
<input type="checkbox" id="toggle" />
<div class="menu">
Home
Partners
<span>Products</span>
<img class="lg-logo" src="https://en.facebookbrand.com/wp-content/themes/fb-branding/prj-fb-branding/assets/images/thumb-drawn.svg" alt="logo">
</div>
</div>

Chechbox is cheched but content cant slide

this is my very first question! Is now a couple of days that I am facing a problementer code here with checkbox creating a slide up/down mobile first menu.
The checkbox is working perfectly but what I am unable to do after is letting the menu slide up and done when checkbox is checked.
Any hint or help for the right direction would be greately appreciated!
<!-- === MENUTOGGLE === -->
<input type="checkbox" name="checkbox" id="menuToggle" value="value">
<label for="menuToggle" class="menu-icon">☰</label>
<!-- ==== HEADER ==== -->
<header>
<div id="logo" class="brand">
<h1><img src="images/logo.png" alt="Hello"></h1>
</div>`enter code here`
<nav class="menu">
<ul>
<li>Work</li>
<li>About</li>
<li>Blog </li>
<li>Contact</li>
</ul>
</nav>
</header>
* {
margin: 0;
padding: 0;
outline: none;
box-sizing: border-box;
}
body {
background: #eee;
color: #444;
-webkit-font-smoothing: antialiased;
font-family: Arial, sans-serif;
font-weight: 400;
height: auto !important;
height: 100%;
min-height: 100%;
text-rendering: optimizeLegibility;
}
.menu {
width: 100%;
position: absolute;
top: 66px;
}
.menu-icon {
float: right;
color: blueviolet;
cursor: pointer;
padding-top: 25px;
padding-right: 30px;
}
#menuToggle {
display: none;
}
#menuToggle:checked + .menu {
position: absolute;
top: -66px;
}
#logo {
float: none;
text-align: left;
padding-top: 7px;
padding-left: 2em;
}
header {
display: block;
background-color: #FFF;
}
nav {
text-align: center;
}
nav ul {
background-color: rgba(255, 255, 255, 0.15);
float: none;
line-height: 3.5em;
margin: 0;
}
nav ul li {
display: block;
list-style-type: none;
}
nav ul li:hover {
background-color: rgba(171, 193, 242, 0.1);
}
nav ul li a {
text-decoration: none;
color: red;
}
nav ul li a:hover {
color: aqua;
}
/*------------ MEDIUM BIG SCREEN -----------------------*/
#media screen and (min-width:600px) {
#logo {
float: left;
}
.menu {
width: 100%;
height: 70px;
position: inherit;
}
.menu-icon {
display: none;
}
header {
height: 70px;
background-color: #FFF;
margin: auto;
width: 100%;
}
nav ul {
background-color: #FFF;
float: right;
padding: 0.55em 3em 0.55em 1.5em;
height: 70px;
}
nav ul li {
display: inline-block;
}
nav ul li a {
background-color: #FFF;
padding-left: 3em;
}
I have modified few lines of your code. Just check below or https://jsfiddle.net/pr7xf32q/, if this is what you expect.
* {
margin: 0;
padding: 0;
outline: none;
box-sizing: border-box;
}
body {
background: #eee;
color: #444;
-webkit-font-smoothing: antialiased;
font-family: Arial, sans-serif;
font-weight: 400;
height: auto !important;
height: 100%;
min-height: 100%;
text-rendering: optimizeLegibility;
}
.menu {
width: 100%;
position: absolute;
top: 66px;
}
.menu-icon {
float: right;
color: blueviolet;
cursor: pointer;
padding-top: 25px;
padding-right: 30px;
}
.menu {
display: none;
}
#menuToggle:checked ~ header .menu {
display: block;
}
#logo {
float: none;
text-align: left;
padding-top: 7px;
padding-left: 2em;
}
header {
display: block;
background-color: #FFF;
}
nav {
text-align: center;
}
nav ul {
background-color: rgba(255, 255, 255, 0.15);
float: none;
line-height: 3.5em;
margin: 0;
}
nav ul li {
display: block;
list-style-type: none;
}
nav ul li:hover {
background-color: rgba(171, 193, 242, 0.1);
}
nav ul li a {
text-decoration: none;
color: red;
}
nav ul li a:hover {
color: aqua;
}
/*------------ MEDIUM BIG SCREEN -----------------------*/
#media screen and (min-width:600px) {
#logo {
float: left;
}
.menu {
width: 100%;
height: 70px;
position: inherit;
display: block;
}
.menu-icon {
display: none;
}
header {
height: 70px;
background-color: #FFF;
margin: auto;
width: 100%;
}
nav ul {
background-color: #FFF;
float: right;
padding: 0.55em 3em 0.55em 1.5em;
height: 70px;
}
nav ul li {
display: inline-block;
}
nav ul li a {
background-color: #FFF;
padding-left: 3em;
}
<input type="checkbox" name="checkbox" id="menuToggle" value="value">
<label for="menuToggle" class="menu-icon">☰</label>
<!-- ==== HEADER ==== -->
<header>
<div id="logo" class="brand">
<h1><img src="images/logo.png" alt="Hello"></h1>
</div>
<nav class="menu">
<ul>
<li>Work</li>
<li>About</li>
<li>Blog </li>
<li>Contact</li>
</ul>
</nav>
</header>

Z-index not taking effect [duplicate]

This question already has answers here:
Using z-index to get div above another div
(4 answers)
Closed 6 years ago.
I designed a mobile menu and I have applied a z-index to the drop down mobile menu, but other elements still show over it. I have tried putting the z-index in these two elements:
.nav_list {}
.nav_list > a {}
Please note you have to be under 640px to see the button. Then when you press it, you will see the word "Hello" appear over the menu.
What am I doing wrong?
$('span.nav-btn').click(function () {
$('ul.nav_list').slideToggle(500);
})
$(window).resize(function (){
if ( $(window).width() > 640 ) {
$('ul.nav_list').removeAttr('style');
}
});
body {
padding: 0;
margin: 0;
max-width: 100%;
background: green;
}
.header {
margin: 0;
background-color: #333;
height: 80px;
}
.header_wrap {
/*margin: 0 15%;*/
width: 960px;
text-align: center;
}
.nav-btn {
display: none;
}
.nav_list {
text-decoration: none;
background-color: #333;
color: #FFF;
margin: 0;
list-style: none;
width: 100%;
}
.nav_list > a {
display: inline-block;
padding: 25px 12px;
text-decoration: none;
}
.nav_list > a > li {
text-decoration: none;
font-size: 1em;
color: #FFF;
}
#media screen and (max-width:640px) {
body {
background: blue;
}
.header_wrap {
margin: 0%;
width: 100%;
}
.nav_list {
padding: 0;
text-align: center;
display: none;
margin-top: 60px;
width: 100%;
}
.nav_list > a {
display: block;
border-bottom: 1px solid #FFF;
width: auto;
}
.nav-btn {
display: block;
background-color: #333;
color: #FFF;
font-size: 1.5em;
/*text-align: right;*/
cursor: pointer;
padding-top: 20px;
}
.nav-btn:before {
background-image: url('http://optimumwebdesigns.com/icons/mobile_menu_white.png');
background-size: 28px 28px;
background-repeat: no-repeat;
width: 28px;
height: 28px;
content:"";
display: block;
float: right;
}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<header class="header">
<div class="header_wrap">
<span class="nav-btn"></span>
<ul class="nav_list">
<li>Home</li>
<li>Spray Foam Insulation</li>
<li>Portable Spray Foam Kits</li>
<li>Polyurea</li>
<li>Personal Protective Equipment</li>
<li>Financing</li>
<li>Contact us</li>
</ul>
</div>
</header>
<p>
Hello
</p>
You need to add the position property to your elements for z index to work
so for instance adding position: relative; to .nav-list then adding your z-index should show the element above the others.
Add a position:absolute; or position:relative; to .nav_list {}. Otherwise, z-index won't work.