transparent arrow underneath a clicked element - html

I cant figure out how to make this transparent arrow to work when the link is ".active"
I created a bar underneath the navigation so the arrow could be transparent with the background, but I don't know how to make it be underneath the ".active" link when you click on it, any ideas to make the transparent arrow to work and be underneath the clicked element?
jsfiddle(please make the screen bigger because it's got media queries)
HTML
body {
background-image: url("http://www.crystalxp.net/galerie/img/th_13740.jpg");
}
#logo {
padding: 10px;
max-width: 210px;
display: inline-block;
margin: 5px auto 0 auto;
}
#media (min-width: 720px) {
#logo {
display: block;
float: left;
height: 54px;
max-width: auto;
width: 210px;
margin: 0px 5px 5px 5px;
padding: 0;
}
}
// header container
.header-container {
width: 100%;
background-color: #252525;
background-color: rgba(37, 37, 37, 0.97);
z-index: 2;
-webkit-box-shadow: 0 1px 4px 0 rgba(100, 100, 100, 0.7);
-moz-box-shadow: 0 1px 4px 0 rgba(100, 100, 100, 0.7);
box-shadow: 0 1px 4px 0 rgba(100, 100, 100, 0.7);
}
.nav-actions {
display: none;
margin: 0;
padding: 0;
list-style: none;
float: right;
}
#media (min-width: 720px) {
.nav-actions {
display: block;
}
}
.nav-actions li {
float: left;
}
#media (min-width: 720px) {
.nav-actions li {
margin-left: 10px;
}
}
#media (min-width: 960px) {
.nav-actions li {
margin-left: 20px;
}
}
.nav-actions li a:link,
.nav-actions li a:visited {
padding: 4px 20px;
display: block;
margin-top: 13px;
text-transform: uppercase;
font-weight: 600;
font-size: 16px;
text-decoration: none;
color: #e49e02;
border: 2px solid #e49e02;
}
.nav-actions li a:hover,
.nav-actions li a:active {
border: 2px solid #ffffff;
color: #ffffff;
}
.nav-actions li a.active {
text-decoration: underline;
}
.nav-list {
list-style-type: none;
padding: 0;
margin: 0;
overflow: hidden;
display: block;
margin: 0;
float: left;
padding: 0 0 0 0px;
display: none;
}
.nav-list li {
display: block;
float: left;
margin: 0;
}
.nav-list li:last-child {
margin-right: 0px;
}
#media (min-width: 720px) {
.nav-list {
display: block;
}
}
.nav-list li {
float: left;
}
.nav-list li a:link,
.nav-list li a:visited {
display: block;
color: #e49e02;
text-decoration: none;
text-transform: uppercase;
font-weight: 600;
}
#media (min-width: 720px) {
.nav-list li a:link,
.nav-list li a:visited {
padding: 15px 10px;
font-size: 0.85em;
}
}
#media (min-width: 960px) {
.nav-list li a:link,
.nav-list li a:visited {
padding: 15px 30px;
font-size: 1.3em;
}
}
.nav-list li a:hover,
.nav-list li a:active {
color: #ffffff;
}
.nav-list li a.active {
color: red;
}
.nav-list li a.active:after,
.nav-list li a.active:before {
content: '';
position: absolute;
top: 62px;
width: 56%;
padding-bottom: inherit;
background-color: rgba(37, 37, 37, 0.97);
}
.nav-list li a.active:before {
right: 49%;
-ms-transform-origin: 100% 100%;
-webkit-transform-origin: 100% 100%;
transform-origin: 100% 100%;
-ms-transform: skewX(-45deg);
-webkit-transform: skewX(-45deg);
transform: skewX(-45deg);
}
.nav-list li a.active:after {
left: 53%;
-ms-transform-origin: 0 100%;
-webkit-transform-origin: 0 100%;
transform-origin: 0 100%;
-ms-transform: skewX(45deg);
-webkit-transform: skewX(45deg);
transform: skewX(45deg);
}
<!--- header container --->
<header class="header-container">
<div class="header-container--inner">
<!--- site logo --->
<a href="/">
<img id="logo" src="http://placehold.it/100x50">
</a>
<!--- main nav --->
<ul class="nav-list">
<li>entries
</li>
<li><a class="" href="">event</a>
</li>
<li><a class="active" href="">store</a>
</li>
<li>archive
</li>
</ul>
<!--- main nav actions --->
<ul class="nav-actions">
<li>enter
</li>
</ul>
<!--- mobile nav link --->
<div class="small-navigation">
<a href="">
<i class="fa fa-bars"></i>
</a>
</div>
</div>
</header>
<!--- main wrapper --->
<div class="main-wrapper">
<!--- main container --->
<div class="main-container">

Related

When down-sizing my website, one of my a tags starts to get hidden and a horizontal scroll bar appears

This is my first website and i'm doing it for a project at school nut i've got a couple of problems. First, when resizing my website one of my buttons starts to disappear for some reason. Secondly, my background color disappears when going below 992px of width. This project is due this week and this is the last part. Anyways, here is my code, the classes, ids and text are in french but the actual code is in english.The image that doesn't appear is supposed to be 2000px by 391px
#import url('https://fonts.googleapis.com/css2?family=Montserrat:wght#100;200;300;400;500;600;700;800;900&display=swap');
:root {
--ming: #16697A;
--pacific-blue: #489FB5;
--middle-blue: #82C0CC;
--isabelline: #EDE7E3;
--orange-peel: #FFA62B;
--white: #FFFFFF;
--black: #000000;
}
* {
box-sizing: border-box;
}
html {
font: 400 100%/150% Montserrat, Arial, Helvetica, sans-serif;
color: var(--white);
}
#media screen and (min-width:768px) {
html {
font-size: 100%;
line-height: 150%;
}
}
body {
margin: 0;
}
#entete,
#pied-page {
background: var(--pacific-blue);
color: var(--white);
}
#entete {
padding: 5%;
}
#media screen and (min-width:768px) {
#entete {
padding: 5% 5% 0;
}
}
#media screen and (min-width:992px) {
#entete {
position: sticky;
top: 0;
left: 0;
z-index: 2;
padding: 0;
}
}
#media screen and (min-width:992px) {
.wrapper-navigation {
display: flex;
align-items: flex-end;
max-width: 1400px;
margin: 0 auto;
}
#logo,
#menu {
flex: 0 0 50%;
}
#logo {
padding: 3% 0% 3% 5%;
}
}
#pied-page * {
color: white;
}
nav ul {
margin: 0;
padding: 0;
list-style: none;
}
#menu {
margin-top: 1rem;
}
#menu ul li a {
color: inherit;
text-decoration: none;
text-transform: uppercase;
display: block;
padding: .5rem 1rem;
border-bottom: 0.063rem solid #fff;
font-weight: 600;
transition: all .3s ease;
}
#menu ul li a:hover,
#menu ul li a:focus {
color: rgba(255, 255, 255, .5);
}
#menu ul li a span {
font-weight: 400;
}
#menu ul li:last-child a {
border-bottom: none;
}
#media screen and (min-width:768px) {
#menu ul {
display: flex;
}
#menu ul li {
padding-top: .5rem;
}
#menu ul li a {
border-bottom: none;
line-height: 1.125rem;
}
#menu ul li a span {
display: block;
}
#menu ul li.active {
background: white;
border-top-left-radius: 1rem;
border-top-right-radius: 1rem;
}
#menu ul li.active a {
color: var(--pacific-blue);
}
}
<header id="entete">
<div class="wrapper-navigation">
<div id="logo">
<img src="images-meme/La culture des memes-logo.jpg">
</div>
<nav id="menu">
<ul>
<li>Introduction <span>au site</span></li>
<li><span>Doge</span> Cheems</li>
<li>Spiderman <span>meme</span></li>
<li><span>Clash</span> Royale</li>
<li class="active">Informations <span>importantes</span></li>
</ul>
</nav>
</div>
</header>
Your media queries need to have larger values.
#import url('https://fonts.googleapis.com/css2?family=Montserrat:wght#100;200;300;400;500;600;700;800;900&display=swap');
:root {
--ming: #16697A;
--pacific-blue: #489FB5;
--middle-blue: #82C0CC;
--isabelline: #EDE7E3;
--orange-peel: #FFA62B;
--white: #FFFFFF;
--black: #000000;
}
* {
box-sizing: border-box;
}
html {
font: 400 100%/150% Montserrat, Arial, Helvetica, sans-serif;
color: var(--white);
}
#media screen and (min-width:1328px) {
html {
font-size: 100%;
line-height: 150%;
}
}
body {
margin: 0;
}
#entete,
#pied-page {
background: var(--pacific-blue);
color: var(--white);
}
#entete {
padding: 5%;
}
#media screen and (min-width:768px) {
#entete {
padding: 5% 5% 0;
}
}
#media screen and (min-width:1328px) {
#entete {
position: sticky;
top: 0;
left: 0;
z-index: 2;
padding: 0;
}
}
#media screen and (min-width:1328px) {
.wrapper-navigation {
display: flex;
align-items: flex-end;
max-width: 1400px;
margin: 0 auto;
}
#logo,
#menu {
flex: 0 0 50%;
}
#logo {
padding: 3% 0% 3% 5%;
}
}
#pied-page * {
color: white;
}
nav ul {
margin: 0;
padding: 0;
list-style: none;
}
#menu {
margin-top: 1rem;
}
#menu ul li a {
color: inherit;
text-decoration: none;
text-transform: uppercase;
display: block;
padding: .5rem 1rem;
border-bottom: 0.063rem solid #fff;
font-weight: 600;
transition: all .3s ease;
}
#menu ul li a:hover,
#menu ul li a:focus {
color: rgba(255, 255, 255, .5);
}
#menu ul li a span {
font-weight: 400;
}
#menu ul li:last-child a {
border-bottom: none;
}
#media screen and (min-width:768px) {
#menu ul {
display: flex;
}
#menu ul li {
padding-top: .5rem;
}
#menu ul li a {
border-bottom: none;
line-height: 1.125rem;
}
#menu ul li a span {
display: block;
}
#menu ul li.active {
background: white;
border-top-left-radius: 1rem;
border-top-right-radius: 1rem;
}
#menu ul li.active a {
color: var(--pacific-blue);
}
}
<header id="entete">
<div class="wrapper-navigation">
<div id="logo">
<img src="images-meme/La culture des memes-logo.jpg">
</div>
<nav id="menu">
<ul>
<li>Introduction <span>au site</span></li>
<li><span>Doge</span> Cheems</li>
<li>Spiderman <span>meme</span></li>
<li><span>Clash</span> Royale</li>
<li class="active">Informations <span>importantes</span></li>
</ul>
</nav>
</div>
</header>

Header on my website does not extend to the left and right as I wish

I want to create a navigation bar that stretches from the logo to the right side of the window. I would like to avoid the use of percentages for responsiveness. In the image below the circle represents the logo.
I have this:
But I want this:
The problem is, I can't get the background like in picture 2 but responsive with the container.
I have this code:
.container {
margin: 0 auto;
max-width: 1100px;
padding: 0 30px;
position: relative;
}
.site-nav {
width: 100%;
height: 230px;
background: #fee17c;
}
.site-nav .nav-logo {
height: 230px;
float: left;
display: flex;
}
.site-nav .nav-logo img {
height: 160px;
margin: auto;
background:red;
}
.site-nav .nav-links {
height: 230px;
float: right;
}
.site-nav .nav-links .nav-links-box {
height: 230px;
display: flex;
}
#media (min-width: 768px) {
.site-nav .nav-links .nav-links-box ul {
list-style: none;
margin: 0;
padding: 0;
margin: auto;
background: red;
background-repeat: no-repeat;
background-size: 100% 100%;
padding: 1rem 0 1rem 0;
}
.site-nav .nav-links .nav-links-box ul li {
margin: 0;
padding: 0;
padding: .7rem 1rem .7rem 0;
text-transform: uppercase;
float: right;
margin: auto;
padding-left: 1rem;
}
.site-nav .nav-links .nav-links-box ul li:not(:last-child) {
padding-right: 1rem;
}
.site-nav .nav-links .nav-links-box ul li a {
color: black;
text-decoration: none;
font-size: 20px;
transition: .5s;
}
.site-nav .nav-links .nav-links-box ul li a:hover {
color: #0864bb;
}
}
#media (max-width: 768px) {
.site-nav .nav-links .nav-links-box ul {
list-style: none;
margin: 0;
padding: 0;
width: 100%;
position: absolute;
top: 230px;
left: 0;
background: 768px-bg;
z-index: 9999;
display: none;
border-bottom: 2px solid #fee17c;
box-shadow: 0 8px 15px 0 rgba(0, 0, 0, 0.08);
}
.site-nav .nav-links .nav-links-box ul li {
padding: 1rem 0 1rem 1.5rem;
}
.site-nav .nav-links .nav-links-box ul.show {
display: block;
}
}
.site-nav .nav-links .toggle-nav {
width: 35px;
height: 230px;
border: 0;
background: none;
padding: 0;
margin: 0;
position: relative;
cursor: pointer;
outline: none;
display: none;
}
#media (max-width: 768px) {
.site-nav .nav-links .toggle-nav {
display: block;
}
}
.site-nav .nav-links .toggle-nav .dashes {
display: block;
width: 100%;
position: relative;
z-index: 2;
}
.site-nav .nav-links .toggle-nav .dashes .dash {
display: block;
width: 100%;
height: 3px;
background-color: #0864bb;
transform-origin: 50% 50%;
transition: transform .4s, -webkit-transform .4s;
}
.site-nav .nav-links .toggle-nav .dashes .dash:not(:first-child) {
margin-top: 6px;
}
.site-nav .nav-links .toggle-nav.show .dashes .dash:nth-child(1) {
transform: translateY(9px) rotate(45deg);
}
.site-nav .nav-links .toggle-nav.show .dashes .dash:nth-child(2) {
visibility: hidden;
}
.site-nav .nav-links .toggle-nav.show .dashes .dash:nth-child(3) {
transform: translateY(-9px) rotate(-45deg);
}
<nav class="site-nav">
<div class="container">
<div class="nav-logo">
<img src="assets/frontend/img/logo.png" alt="">
</div>
<!-- .nav-logo -->
<div class="nav-links">
<button class="toggle-nav">
<span class="dashes" aria-hidden="true">
<span class="dash"></span>
<span class="dash"></span>
<span class="dash"></span>
</span>
<span class="txt">Menu</span>
</button>
<!-- .toggle-nav -->
<div class="nav-links-box">
<ul class="nav-list">
<li>Home</li>
<li>Home</li>
<li>Home</li>
<li>Home</li>
<li>Home</li>
<li>Home</li>
</ul>
</div>
</div>
<!-- .nav-links -->
</div>
<!-- .container -->
</nav>
<!-- .site-nav -->
Anyone help me please?
To get the background of the menu to reach the logo, you need to have the .container have display: flex, not the logo. Then you can remove the float properties and make the menu have flex-grow: 1;
Here's an example that works for desktop. I commented out all the media so that it's a little easier to see on StackOverflow, but you'll have to add them back and adapt this to mobile pages.
.container {
margin: 0 auto;
max-width: 1100px;
padding: 0 30px;
position: relative;
display: flex;
}
.site-nav {
width: 100%;
height: 230px;
background: #fee17c;
}
.site-nav .nav-logo {
height: 230px;
}
.site-nav .nav-logo img {
height: 160px;
margin: auto;
background:red;
}
.site-nav .nav-links {
height: 230px;
flex-grow: 1;
}
.site-nav .nav-links .nav-links-box {
height: 230px;
display: flex;
}
/*#media (min-width: 768px) {*/
.site-nav .nav-links .nav-links-box ul {
list-style: none;
margin: 0;
padding: 0;
margin: auto;
background: red;
background-repeat: no-repeat;
background-size: 100% 100%;
padding: 1rem 0 1rem 0;
width: 100%;
}
.site-nav .nav-links .nav-links-box ul li {
margin: 0;
padding: 0;
padding: .7rem 1rem .7rem 0;
text-transform: uppercase;
float: right;
margin: auto;
padding-left: 1rem;
}
.site-nav .nav-links .nav-links-box ul li:not(:last-child) {
padding-right: 1rem;
}
.site-nav .nav-links .nav-links-box ul li a {
color: black;
text-decoration: none;
font-size: 20px;
transition: .5s;
}
.site-nav .nav-links .nav-links-box ul li a:hover {
color: #0864bb;
}
/*}
#media (max-width: 768px) {
.site-nav .nav-links .nav-links-box ul {
list-style: none;
margin: 0;
padding: 0;
width: 100%;
position: absolute;
top: 230px;
left: 0;
background: 768px-bg;
z-index: 9999;
display: none;
border-bottom: 2px solid #fee17c;
box-shadow: 0 8px 15px 0 rgba(0, 0, 0, 0.08);
}
.site-nav .nav-links .nav-links-box ul li {
padding: 1rem 0 1rem 1.5rem;
}
.site-nav .nav-links .nav-links-box ul.show {
display: block;
}
}*/
.site-nav .nav-links .toggle-nav {
width: 35px;
height: 230px;
border: 0;
background: none;
padding: 0;
margin: 0;
position: relative;
cursor: pointer;
outline: none;
display: none;
}
/*
#media (max-width: 768px) {
.site-nav .nav-links .toggle-nav {
display: block;
}
}
*/
.site-nav .nav-links .toggle-nav .dashes {
display: block;
width: 100%;
position: relative;
z-index: 2;
}
.site-nav .nav-links .toggle-nav .dashes .dash {
display: block;
width: 100%;
height: 3px;
background-color: #0864bb;
transform-origin: 50% 50%;
transition: transform .4s, -webkit-transform .4s;
}
.site-nav .nav-links .toggle-nav .dashes .dash:not(:first-child) {
margin-top: 6px;
}
.site-nav .nav-links .toggle-nav.show .dashes .dash:nth-child(1) {
transform: translateY(9px) rotate(45deg);
}
.site-nav .nav-links .toggle-nav.show .dashes .dash:nth-child(2) {
visibility: hidden;
}
.site-nav .nav-links .toggle-nav.show .dashes .dash:nth-child(3) {
transform: translateY(-9px) rotate(-45deg);
}
<nav class="site-nav">
<div class="container">
<div class="nav-logo">
<img src="http://via.placeholder.com/230x230" alt="">
</div>
<!-- .nav-logo -->
<div class="nav-links">
<button class="toggle-nav">
<span class="dashes" aria-hidden="true">
<span class="dash"></span>
<span class="dash"></span>
<span class="dash"></span>
</span>
<span class="txt">Menu</span>
</button>
<!-- .toggle-nav -->
<div class="nav-links-box">
<ul class="nav-list">
<li>Home</li>
<li>Home</li>
<li>Home</li>
<li>Home</li>
<li>Home</li>
<li>Home</li>
</ul>
</div>
</div>
<!-- .nav-links -->
</div>
<!-- .container -->
</nav>
<!-- .site-nav -->
This way you won't reach the right side of the page with the background tho. That is because your container has a max width and doesn't go that far. There are many ways to go around that, but it's not straightforward. The easiest way might be to remove the max-width from the container, and then give the internal elements margins on the right and left.

Why wont my nav display dropdown-links vertically?

I have been sitting for 4 hours now trying to make my nav display dropdown-links vetically but it continues to show them horizontally instead. I can´t figure out why this is happening or how to fix it.
I would appreciate it very much if some kind soul could tell me what I am doing wrong. I have a sneaking suspecion this is caused due to my settings for the nav (it changes size at a certain width) but I am not sure...
I have ripped my nav from my website and thrown everything into codepen, but even after several attempts to figure out where the problem starts - nothing! It displays "link1" right below and then just adds "link2" and "link3" to the right of it, instead of under
Please help?
Codepen: https://codepen.io/Pinchofginger/pen/BJJQgZ
If there are any oddities in the CSS it´s because I have a dropdown menu for mobile that display when you press an icon... it is not currently working either, but that a question for another time.
My HTML
<header class="mainheader">
<section id="baggrund">
<div id="mainlogo">
Sønderborg
<p> og omegns</p> Kattelaug<br />
<img class="vector" src="billeder/udklip.png" alt="Kattesilhuet"></div>
<nav>
<input type="checkbox" id="menu-checkbox" role="button" />
<label for="menu-checkbox" id="menu-button">
<span class="bar"></span>
<span class="bar"></span>
<span class="bar"></span>
</label>
<div id="nav_wrap">
<ul id="menu">
<li>Forside</li>
<li>Adopter en kat</li>
<li>Tilløber katte</li>
<li> Kattens pleje</li>
<li class="dropdown">
<a href="javascript:void(0)" class="dropbtn">
Kontakt</a><div class="dropdown-content">
Link 1
Link 2
Link 3
</div>
</li>
</ul></div>
</nav>
</section>
</header>
MY CSS
/* small nav */
#media screen and (max-width: 61em) {
#menu li {
width: 20%;
}
#menu li a {
font-size: 0.9em;
width:100%;
color:red;}
#menu ul {width:100%;}
/*sidebar*/
body#index .sidemenu .sidebar1 {padding: 0 0 0 0;}
body#index #Mega {width: 96%; height:80px;}
body#index .sidemenu .sidebar1 h3 {font-size: 0.9em;}
}
/* stor nav*/
#media screen and (min-width: 61em) {
#menu li {
width: 20%;
}
#menu li a {
font-size: 1.2em;
width:100%;
color: #505050;
}} /*slut, stor*/
#menu li {
display: inline-block;
background: none;
padding: 5px 5px 5px 5px;
}
#menu li a {
text-transform: uppercase;
transition: all .5s ease;
text-decoration: none;
text-align: center;
line-height: 55px;
display: inline-block;}
.sidemenu .pleje {font-size: 0.9em; display:inline-block }
.sidemenu .pleje h3 {color: orange;}
#mainlogo {
display: block;
}
.mainheader {
width: 100%;
}
#bannerkat { display: none;}
#menu-button { display: none;}
#menu {
display: block;
border-radius: 0;
text-align: center;
position: relative;
}
/* Navigations menuen (links osv) */
#nav_wrap {
background: #f9f4ea;
width: 100%;
white-space: nowrap;
float: left;
height: 60px;
position: relative;
margin-top: 144px;
bottom: 0;
/* overflox:hidden; */
z-index: 9999;
opacity: .9;
box-shadow: 0px 1px 4px beige;
padding: 0;
}
li a, .dropbtn {
display: inline-block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover, .dropdown:hover .dropbtn {
background-color: red;
}
li.dropdown {
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
.dropdown-content a:hover {background-color: #f1f1f1}
.dropdown:hover .dropdown-content {
display: block;
}
/* højde for billed-sektion*/
.mainheader section {
min-height: 204px;
}
#mainlogo {
font-size: 37px;
color: white;
border: 7px solid white;
display: inline-block;
padding: 10px;
position: absolute;
height: 123px;
/* hvid boks*/
line-height: 25px;
top: 202px;
margin-top: -180px;
left: 50%;
width: 600px;
text-align: center;
margin-left: -300px;
text-shadow: 1px 2px 1px #000;
box-shadow: 1px 2px 1px #000;
}
/* og omegns */
#mainlogo p {
font-size: 20px;
padding: 5px;
}
.vector {
width: 60px;
margin-left: -450px;
margin-top: -36px;
}
.mainheader {
margin-top: 10px;
}
Change line 42 in css: "menu li a" to Display: block instead of Display: inline-block:
#menu li a {
text-transform: uppercase;
transition: all .5s ease;
text-decoration: none;
text-align: center;
line-height: 55px;
display: block;
}

Navbar Dropdown List Items Appearing Aligned Left Before Animation

I would like my navbar dropdown menu to take up the entire browsing area with the list items centered, and have a brief animation during the transition.
For the animation, I want the .icon-bar hamburger menu to transition to an "X" and for the dropdown menu to have a cubic-bezier transition.
However, the list items first appear aligned left prior to the animation.
Wondering why the list is left-aligned prior to animation.
html, body {
height: 100%;
margin: 0;
padding: 0;
font-family: 'Quicksand', sans-serif;
}
body {
margin-top: 60px;
}
#main-wrapper {
display: flex;
flex-direction: column;
min-height: 100%;
}
.container {
margin: 0 auto;
}
.article {
flex: 1;
}
/*START Shrinks the default navbar height*/
.navbar {
//min-height: 30px;
margin: 0px;
width: 100%;
background-color: #444;
//height: 44px;
}
.navbar-nav > li,
.navbar-nav > li > a,
.navbar-nav > li > a:link,
.navbar-nav > li > a:visited {
padding: 4px 5px 0px 5px;
//height: 30px;
color: white;
font-size: 1.1em;
font-weight: 300;
margin: 2px 8px 0 0;
}
/*END*/
.nav.navbar-nav li a:focus,
.nav.navbar-nav li a:active,
.nav.navbar-nav li a:hover {
color: white;
opacity: 0.8;
}
.navbar-toggle {
float: left;
border: none;
margin-top: 10px;
margin-left: 10px;
padding: 4px;
}
.navbar-default .navbar-toggle:hover,
.navbar-default .navbar-toggle:active,
.navbar-default .navbar-toggle:focus {
background-color: #444;
}
/*Displays navbar dropdown on hover */
ul.nav li.dropdown:hover ul.dropdown-menu {
display: block;
}
.navbar-default .navbar-header .icon-bar {
background-color: white;
width: 22px;
}
.navbar-default .navbar-toggle:hover .icon-bar {
background-color: #EFEFEF;
}
.navbar .navbar-brand {
color: white;
margin: -4px 20px -3px 0;
font-size: 1.7em;
font-family: 'Orbitron', 'Dosis', sans-serif;
}
.navbar .navbar-brand:focus,
.navbar .navbar-brand:hover {
color: white;
opacity: 0.8;
}
.fa-caret-down {
height: 30px;
color: lightGray;
}
/*Change hamburger menu to "x" on click */
.navbar-toggle .icon-bar {
width: 22px;
transition: all 0.4s;
}
.navbar-toggle .top-bar {
transform: rotate(405deg);
transform-origin: 10% 10%;
}
.navbar-toggle .middle-bar {
opacity: 0;
}
.navbar-toggle .bottom-bar {
transform: rotate(-405deg);
transform-origin: 10% 90%;
}
.navbar-toggle.collapsed .top-bar {
transform: rotate(0);
}
.navbar-toggle.collapsed .middle-bar {
opacity: 1;
}
.navbar-toggle.collapsed .bottom-bar {
transform: rotate(0);
}
.navbar.navbar-default .navbar-collapse {
border: none;
box-shadow: none;
}
/*Change Background color of toggle dropdown*/
.collapse.navbar-collapse {
background-color: #444;
min-width: 100%;
min-height: 100%;
}
h3 + p {
line-height: 1.8em;
}
footer {
background-color: #444;
color: white;
height: 250px;
padding: 8px;
}
footer a,
footer a:link,
footer a:visited {
color: white;
text-decoration: none;
}
footer a:hover,
footer a:active,
footer a:focus {
opacity: 0.8;
}
.tagline {
text-align: center;
}
.footer-sub {
border: thin white solid;
margin: 0 2px 7px 0;
max-width: 220px;
}
.fa-plus {
margin-top: 3px;
float: right;
}
.fa-plus:hover {
opacity: 0.8;
cursor: pointer;
}
#location-detail {
display: none;
}
a#location:focus + #location-detail {
display: block;
}
#media (max-width: 992px) {
.navbar-nav > li,
.navbar-nav > li > a,
.navbar-nav > li > a:link,
.navbar-nav > li > a:visited,
.navbar-nav > li > a:hover {
font-size: 1.05em;
}
}
#media (max-width: 767px) {
.navbar .navbar-brand {
position: absolute;
left: 50%;
margin-left: -110px !important;
display: block;
}
.collapse.navbar-collapse {
background-color: #444;
position: fixed;
min-width: 100%;
min-height: 100%;
font-size: 1.3em;
text-align: center;
padding-top: 20px;
transition-property: all;
transition-duration: 0.5s;
transition-timing-function: cubic-bezier(0, 1, 0.5, 1);
}
.collapse.navbar-collapse li {
margin-bottom: 15px;
}
}
<div id="main-wrapper">
<div class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar top-bar"></span>
<span class="icon-bar middle-bar"></span>
<span class="icon-bar bottom-bar"></span>
</button>
<!--<img class="logo" src="../images/eclipse-new.png"/> -->
Eclipse Music
</div> <!-- end of navbar-header -->
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<!--<li><span class="glyphicon glyphicon-home"></span>Home</li>-->
<li>Effects</li>
<li>Guitar</li>
<li>Bass</li>
<li>Amps</li>
<li>Lessons</li>
<li class="dropdown">
About<!-- <i class="fa fa-caret-down"></i>-->
<ul class="dropdown-menu">
<li>Directions</li>
<li>Contact Us</li>
<li>Blog</li>
</ul>
</li>
</ul>
</div> <!-- end of collapse navbar-collapse -->
</div> <!-- end of container -->
</div> <!-- end of navbar navbar-default navbar-fixed-top -->
<div class="article">
<div class="container">
<h2>
Welcome!
</h2>
<br />
</div>
</div> <!-- END of article -->
<footer>
</footer> <!-- END of footer -->
</div> <!-- END of main-wrapper -->
Just add this css in your media query for Xs :
#media (max-width: 767px) {
.navbar .navbar-brand {
position: absolute;
left: 50%;
margin-left: -110px !important;
display: block;
}
.navbar-collapse {
text-align: center;
}
.navbar-collapse li{display:none}
.collapse.navbar-collapse {
background-color: #444;
position: fixed;
min-width: 100%;
min-height: 100%;
font-size: 1.3em;
padding-top: 20px;
transition-property: all;
transition-duration: 0.5s;
transition-timing-function: cubic-bezier(0, 1, 0.5, 1);
}
.collapse.navbar-collapse li {
display:block;
margin-bottom: 15px;
}
}
Here is a bootply with this change : http://www.bootply.com/BQGSpd2kLt
I could be wrong, but it might be this:
.navbar-toggle {
float: left;
border: none;
margin-top: 10px;
margin-left: 10px;
padding: 4px;}
May want those to be something more like this:
.navbar-toggle {
float: right;
border: none;
position: relative;
left: -50%; //or right 50%
text-align: left;
padding: 4px;}

Mobile navigation not static

I made a navbar with a mobile media query, but when I try to hover over the hamburger menu, the navbar isn't static and I cant click any links.
Can anyone help me to fix this, I've already been trying for 90 mins :/
JSFiddle: https://jsfiddle.net/dxmbc5p6/
All code in Jsfiddle:
<body class="animated fadeIn">
<div class="nav animated fadeInDown">
<img src="hamburger.png" alt="" class="hamburger">
<div class="logo">
<h1>TITLE</h1>
</div>
<ul>
<li>
PAGE
<ul>
<li>DROPDOWN</li>
<li>DROPDOWN</li>
</ul>
</li>
<li>PAGE</li>
<li>PAGE</li>
<li>PAGE</li>
</ul>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
</body>
* {
padding: 0;
margin: 0;
border: 0;
}
html, body {
height: 100%;
width: 100%;
font-family: 'Open Sans', sans-serif;
}
h1 {
font-weight: 300;
font-size: 50px;
}
.nav {
width: 100%;
height: 10%;
background-color: #FFF;
text-align: center;
position: fixed;
z-index: 999;
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
}
.nav .hamburger {
display: none;
}
.nav .logo {
float: left;
margin-left: 150px;
}
.nav .logo h1 {
color: #222;
line-height: 10vh;
font-size: 32px;
}
.nav > ul {
height: 100%;
width: auto !important;
display: inline-block;
float: right;
margin-right: 150px;
}
.nav > ul > li {
display: inline-block;
list-style: none;
padding: 0 20px 0 20px;
vertical-align: top;
position: relative;
}
.nav > ul > li:first-child > a:after {
width: 6px;
height: 6px;
border-bottom: 1px solid #000;
border-right: 1px solid #000;
position: absolute;
margin-top: calc(5vh - 5px);
margin-left: 8px;
content: "";
transform: rotate(45deg);
}
.nav > ul > li > ul {
display: none;
margin-left: -50%;
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
}
.nav > ul > li > ul > li {
list-style: none;
background-color: #FFF;
padding: 0 20px 0 20px;
position: relative;
}
.nav li:hover > ul {
display: block;
}
.nav ul a {
color: #222;
text-decoration: none;
line-height: 10vh;
}
.nav a:hover {
color: #999;
}
.landing {
padding-top: 10vh;
height: 50%;
width: 100%;
background: url('bg.jpg');
background-size: cover;
position: relative;
text-align: center;
color: #FFF;
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
}
#media only screen and (max-width: 850px){
.nav .hamburger {
height: 6%;
display: block;
float: left;
margin: 2% 0 0 2%;
left: 0;
top: 0;
position: fixed;
}
.nav .logo {
text-align: center;
margin: 0;
float: none;
}
.nav > ul {
display: none;
float: none;
width: 100%;
}
.nav .hamburger:hover ~ ul {
display: block;
width: 100%;
margin: 0;
}
.nav > ul:hover {
display: block;
width: 100%;
}
.nav ul:hover li {
width: 100%;
padding: 0;
}
.nav > ul > li {
display: block;
background-color: #F2F2F2;
}
.nav > ul > li > ul > li {
background-color: #D4D4D4;
}
}
Try adding this to the css.
ul > li a,
.nav > ul > li > ul > li a
{
display:block;
}
I will also point out that with a media tag detecting width as your way of detecting mobile. Your mobile site will display on desktops as well when the browser is shrunk below 850px. This will be a problem with your hover event as it will not fire after to mouse leaves the hamburger.
It doesn't work because of the fact that as soon as you leave the image it looses it's hover state. Look at this example from your code:
<li>
<li>PAGE</li>
<ul>
<li>DROPDOWN</li>
<li>DROPDOWN</li>
</ul>
</li>
And the CSS
.nav li:hover > ul {
display: block;
}
You put the css on the first li which contains the section as well as the sub section. This way it doesn't matter if you are over the anchor element or the unordered list, they are still part of the first li so it is hovered.
In the hamburger situation you put the hover css on a element which doesn't contain the menu so as soon as you leave the hamburger image it looses it's hover state.