How do i make my nav menu permanently on top? I have two nav menu's on a page - a main hamburger nav menu that clicks and pops up, and then an embedded page nav menu
I would like the hamburger nav menu to be permanently on top, but for some reason the embedded nav menu appears through.
Here is a codepen of the issue: https://codepen.io/TheGreatEscape/pen/ebYgGO
Here is a short youtube video if the issue: https://youtu.be/sWzCLOzRJUQ
and the related CSS Code:
/*===== NAV BUTTONS ===*/
#menu-button{ display:none}
a {
-webkit-transition: .3s all ease;
-o-transition: .3s all ease;
transition: .3s all ease;
}
a:hover, a:active, a:focus {
outline: none;
float:none;
clear:both;
text-align:center;
display:inline-block;
position:absolute;
left:0;
right:0 }
.templateux-navbar {
position: fixed;
top: 0px;
left: 0;
width: 100%;
padding: 0;
z-index: 99999;
}
.templateux-navbar .container-fluid {
max-width: 100%;
}
.templateux-navbar .toggle-menu {
z-index: 9999;
}
.templateux-navbar .templateux-menu {
top:35px;
float:none;
clear:both;
text-align:center;
display:inline-block;
position:absolute;
right:210px
}
.templateux-navbar .templateux-menu ul {
position:relative;
float:right;
margin-bottom: 0;
margin-top: 18.5px;
right:178px;
}
.templateux-navbar .templateux-menu ul li {
display: block;
}
.templateux-navbar .templateux-menu ul li a {
left:30px;
top:.5px;
text-decoration: none;
border-radius:0; border:none;
line-height:40px;
display:block;
margin-right: 0px;
font-size: 13px;
text-transform: uppercase;
letter-spacing: .05em;
color: #1a1a1a;
position: relative;
padding-bottom: 5px;
}
.templateux-navbar .templateux-menu ul li a:before {
content: "";
position: absolute;
bottom: 6px;
height: 3px;
width: 0;
left: 0px;
background: #f70f4d;
-webkit-transition: .45s width ease;
-o-transition: .45s width ease;
transition: .45s width ease;
}
.templateux-navbar .templateux-menu ul li a:hover:before {
width: 100%;
}
.templateux-navbar .templateux-menu ul li a:hover {
text-decoration: none;
background-color: inherit;
border:none;
color:#1a1a1a;
font-weight:bold
}
.templateux-navbar .templateux-menu ul li h5 {
position: absolute;
text-decoration: none;
background-color: inherit;
left: 125px;
top: -8px;
color:#1a1a1a;
font-weight:bold;
font-size: 13px;
border-radius:0;
border:none;
line-height:40px;
display: inline-block;
width: 100%;
letter-spacing: .1em;
}
.templateux-navbar .templateux-menu ul li.active > a:before {
width: 100%;
}
.templateux-navbar .templateux-menu ul li:last-child a {
margin-right: 0;
}
/*===== BACKGROUND MENU FOR MENU BUTTON, GET IN TOUCH ===*/
.menu {
width: 33px;
height: 33px;
padding: 5px;
display: block;
cursor: pointer;
position: relative;
float: right;
right: -56px;
top: 24px;
z-index: 1;
}
.menu span {
cursor: pointer;
height: 3.25px;
width: 24px;
margin-bottom: 3px;
background: #000;
position: relative;
right: 0;
display: block;
transform: rotate(0deg);
transition: .7s ease;
}
.hidden {
opacity: 0;
transition-delay: .5s;
pointer-events: none;
cursor: default;
}
.visible {
opacity: .97;
}
.menu.open span:nth-child(1) {
top: 10px;
transform: rotate(180deg);
transition: .7s ease;
background: #ffffff;
}
.menu.open span:nth-child(2) {
opacity: 0;
right: 100px;
background: #000;
}
.menu.open span:nth-child(3) {
top: 0px;
transform: rotate(-180deg);
transition: .8s ease;
background: #ffffff;
}
#navigation {
background: #000000;
font-family: 'Titling Gothic Bold';
color: rgb(0, 0, 0);
font-size: 0px;
width: 100%;
height: 450px;
text-align:left;
}
Your issue is the z-index. I fixed it by adding the class hamburger to your first .templateux-navbar element and then modified your CSS a bit. You can see the modified CSS below.
.templateux-navbar {
position: fixed;
top: 0px;
left: 0;
width: 100%;
padding: 0;
z-index: 9;
}
.templateux-navbar.hamburger {
z-index: 10;
}
Your code has this issue because you gave both the menus the same z-index so it means that the element that is defined next in the HTML will naturally get higher priority, which in your case is your second nav.
Making your hamburger menu have a higher z-index solves this issue.
Related
Right now on hover the underline animation I've set up for my .nav extends past the link, and I want to make it so it only takes up the width of the link. The width is set to 100%, so I'm not quite sure why it's doing that. Also tried messing around with padding to see if that was the issue but didn't work. Could it be because of bootstrap?
html, body {
font-family:;
margin:0 auto;
text-transform: lowercase;
font-family: Roboto;
letter-spacing: 0.5px;
}
.nav {
float: right;
display: inline-block;
margin:0 auto;
list-style: none;
}
.nav li {
display: inline-block;
margin:0 auto;
list-style: none;
list-style: none;
display: inline;
padding-top:0;
padding-left: 10px;
}
.nav > li > a {
padding: 10px;
color: white;
font-family: Roboto;
text-decoration: none;
position: relative;
width:100%;
}
.nav > li > a:hover {
background-color:transparent;
text-decoration: none;
}
.nav > li > a:focus {
background-color:transparent;
text-decoration: none;
}
.nav > li > a:before {
content: "";
position: absolute;
width: 100%;
height: 2px;
bottom: 0;
left: 0;
background-color:white;
visibility: hidden;
-webkit-transform: scaleX(0);
transform: scaleX(0);
-webkit-transition: all 0.3s ease-in-out 0s;
transition: all 0.3s ease-in-out 0s;
}
.nav > li > a:hover:before {
visibility: visible;
-webkit-transform: scaleX(1);
transform: scaleX(1);
width:100%;
}
.work h1 {
border-left: 0px solid black;
padding-top:30px;
display:inline-block;
left:50%;
position: absolute;
transform: translate(-50%, -50%);
color:;
}
.work a {
color: black;
text-decoration: none;
}
.supporting .container-fluid {
background-image: url("img/photo-top.jpg");
height: 600px;
background-size: cover;
background-position: center center;
text-align: center;
position:relative;
top: 0;
width: ;
height: 100vh;
}
.work .container-fluid {
height:500px;
margin: 0 auto;
background: white);
width:100%;
padding:0;
}
.photography .container-fluid {
height:500px;
margin: 0 auto;
background: white);
width:100%;
padding:0;
}
.photography a {
border-left: 0px solid black;
padding:10px;
display:inline-block;
left:50%;
position: absolute;
transform: translate(-50%, -50%);
color:black;
}
div.container-fluid {
padding:0;
width:100%;
height: 100%;
}
.info {
position: absolute;
top: 50%;
left: calc(50% - 180px);
width: 360px;
}
.info h1 {
margin:0 auto;
color:white;
font-size: 50px;
}
.info a {
color: white;
}
.info a:hover {
color: white;
background-color:transparent;
text-decoration: none;
}
}
Currently the bottom-right menu on my website moves up when you click a menu item: http://www.jameswinfield.co.uk/v2.html
How do I get the menu itself to stay where it is and the menu items to display upwards?
My CSS is below:
.menu4 {
position: fixed;
z-index: 9999;
margin-top: 0px;
}
.menu4 nav {
-webkit-opacity: 0;
-moz-opacity: 0;
-ms-opacity: 0;
-o-opacity: 0;
opacity: 0;
}
.menu4 input#slide4:checked ~ nav {
-webkit-opacity: 1;
-moz-opacity: 1;
-ms-opacity: 1;
-o-opacity: 1;
opacity: 1;
}
.menu4 label {
position: fixed;
font-size: 50px;
cursor: pointer;
z-index: 9999;
}
.menu4 input#slide4 {
display: none;
}
.menu4 input#slide4:checked ~ label.open i {
-webkit-transform: rotate(-90deg);
-moz-transform: rotate(-90deg);
-ms-transform: rotate(-90deg);
-o-transform: rotate(-90deg);
transform: rotate(-90deg);
}
.menu4 label i,
.menu4 nav,
.menu4 nav ul li a span {
-webkit-transition: all 0.2s ease-in-out;
-moz-transition: all 0.2s ease-in-out;
-ms-transition: all 0.2s ease-in-out;
-o-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;
}
.menu4 label,
.menu4 nav ul li a i,
.menu4 nav ul li a span {
line-height: 120px;
text-align: center;
width: 120px;
height: 120px;
}
.menu4 nav ul {
list-style: none;
overflow: hidden;
}
.menu4 nav ul li a i {
font-size: 30px;
}
.menu4 nav ul li a span {
font-family: 'Lato', tahoma, sans-serif;
font-size: 17.14285714px;
text-transform: uppercase;
width: 0;
}
.menu4 nav ul li a:hover span {
width: 100px;
padding: 0 10px;
}
.menu4 nav ul li.active a span {
width: 100px;
padding: 0 10px;
}
.menu4.top {
bottom: 0px;
}
.menu4.bottom {
bottom: 0px;
}
.menu4.left,
.menu4.left label {
right: 0;
}
.menu4.right,
.menu4.right label {
right: 0;
}
.menu4.horizontal nav ul li,
.menu4.horizontal nav ul li a span {
float: left;
}
.menu4.left.horizontal nav {
margin-right: -50px;
}
.menu4.left.horizontal input#slide4:checked ~ nav {
margin-right: 120px;
}
.menu4.right.horizontal nav {
margin-right: -60px;
}
.menu4.right.horizontal input#slide4:checked ~ nav {
margin-right: 60px;
}
.menu4.blue label,
.menu4.blue nav ul li a ul li i {
color: #F82D27;
}
.menu4.blue nav ul li a span {
color: #F235E9;
}
.mixcloud {
display: none;
opacity: 0.7;
margin-left: 10px;
}
.youtube {
display: none;
opacity: 0.7;
}
The menu slides upwards from outside of the viewport, so position: fixed is a good choice here.
The menu container is also given position: fixed and it will remain fixed in place, relevant to the viewport.
Example
This is using :hover to simplify things, but can easily be adapted.
nav {
position: fixed;
bottom: 0;
left: 20px;
padding: 30px;
z-index: 2;
}
nav > a {
background: #F90;
padding: 20px;
color: #000;
}
.slideUp {
bottom: -400px;
left: 20px;
height: 400px;
width: 500px;
background: #F00;
position: fixed;
transition: bottom .3s linear;
z-index: 1;
}
nav:hover + .slideUp,
.slideUp:hover {
bottom: 80px;
}
<nav>
I am a menu item, hover me please
</nav>
<div class="slideUp"></div>
I created a navigation menu for a re-design of a website that's a Printing Company. Everything is working perfectly, but I can't find out why the Navigation shrinks when you change the browser size. I've created these menus before, and I've never had a problem with shrinking.
Here is the Demo https://jsfiddle.net/dshojaei/vbcztkdy/3/embedded/result/
#nav_wrap {
text-align: center;
background-color:#343232;
border-top:1px solid black;
height:54px;
}
/* Reset */
.nav,
.nav a,
.nav ul,
.nav li,
.nav div,
.nav form,
.nav input {
margin: 0;
padding: 0;
border: none;
outline: none;
}
.nav a { text-decoration: none; }
.nav li { list-style: none; }
/* Menu Container */
.nav {
display: inline-block;
position: relative;
cursor: default;
z-index: 500;
text-align:left;
}
/* Menu List */
.nav > li {
display:block;
float: left;
}
/* Menu Links */
.nav > li > a {
position: relative;
display: block;
z-index: 510;
height: 54px;
padding: 0 20px;
line-height: 54px;
font-family: Helvetica, Arial, sans-serif;
font-weight: bold;
font-size: 13px;
color: #fcfcfc;
text-shadow: 0 0 1px rgba(0,0,0,.35);
background: #343232;
border-left:none;
border-right:none;
-webkit-transition: all .3s ease;
-moz-transition: all .3s ease;
-o-transition: all .3s ease;
-ms-transition: all .3s ease;
transition: all .3s ease;
}
.businesscards:hover > a {
background:#009ad6;
}
.flyers:hover > a{
background:#c60077;
}
.cards:hover > a {
background:#cec41e;
}
.banner:hover > a {
background:#000000;
}
.dvd:hover > a {
background:#3c3c3c;
}
.stationary:hover > a {
background:#7b7b7b;
}
.labels:hover > a {
background:#afafaf;
}
.catalogs:hover > a {
background:#d7d7d7;
}
.nav > li:first-child > a {
border-radius: 0px 0 0 0px;
border-left: none;
}
/* Menu Dropdown */
.nav > li > div {
position: absolute;
display: block;
width: 100%;
top: 55px;
left: 0;
opacity: 0;
visibility: hidden;
overflow: hidden;
border-right:1px solid black;
border-left:1px solid black;
border-bottom:1px solid black;
background: #ffffff;
border-radius: 0 0 3px 3px;
-webkit-transition: all .3s ease .15s;
-moz-transition: all .3s ease .15s;
-o-transition: all .3s ease .15s;
-ms-transition: all .3s ease .15s;
transition: all .3s ease .15s;
}
.nav > li:hover > div {
opacity: 1;
visibility: visible;
overflow: visible;
}
/* Menu Content Styles */
.nav .nav-column {
float: left;
width: 20%;
padding: 2.5%;
}
.nav .nav-column h3 {
margin: 20px 0 10px 0;
line-height: 18px;
display:inline;
font-family: Helvetica, Arial, sans-serif;
font-weight: bold;
font-size: 14px;
color: #372f2b;
text-transform: uppercase;
}
/*.nav .nav-column img {
display:inline;
width:20%;
height: 20%;
}
*/
.nav img:nth-of-type(1) {
margin-top:30px;
margin-left:20px;
float:left;
width:5%;
height:5%;
}
.nav img:nth-of-type(2) {
margin-top:30px;
margin-left:20px;
float:left;
width:5%;
height:5%;
}
#brochure {
margin-top:30px;
margin-left:20px;
float:left;
width:3%;
height:3%
}
.nav .nav-column h3.orange { color: #ff722b; }
.nav .nav-column li a {
display: block;
line-height: 26px;
font-family: Helvetica, Arial, sans-serif;
font-weight: bold;
font-size: 13px;
color: #888888;
}
.nav .nav-column li a:hover { color: #666666; }
fix the width.
.nav {
display: inline-block;
position: relative;
cursor: default;
z-index: 500;
text-align: left;
width: 1190px;
}
You can change the code for the list items to the following:
.nav > li {
display: inline-block;
}
And, add the following declaration to the list rule set:
.nav {
display: inline-block;
position: relative;
cursor: default;
z-index: 500;
text-align:left;
white-space: nowrap;
}
In order, for this to display properly, the list items, in HTML, should be next to each other, otherwise you'll see spaces:
<ul><li></li><li></li></ul>
I'm trying to create similar effect found here:
codepen.io/davekilljoy/pen/wHAvb?editors=010
The first button effect to be more specific. I followed most instructions, and added in a few changes to make it fill in from the left instead.
For some reason when I hover over it, it fills in the whole table instead of just the button. I want it to start from the beginning of the button to the end, not from the beginning of the table to the end.
Here's a crappy quality GIF so you get the idea of what's happening now: http://i.imgur.com/vz5TTjy.gif
This is the CSS:
#nav {
float: left;
position: relative;
left: -20px;
}
#nav ul {
list-style-type: none;
}
#nav ul li button {
font-family: 'Roboto', sans-serif;
font-size: 15px;
color: #383736;
letter-spacing:2px;
text-transform: uppercase;
overflow: none;
cursor: pointer;
outline: 0;
background: none;
background: white;
border: 1px solid #383736;
border-radius: 3px;
padding: 7px 12px;
margin: 35px 0px;
z-index: 1;
-webkit-transition: 0.08s ease-in;
}
#nav ul li button:hover {
color: white;
}
#nav ul li button::before {
content: "";
position: absolute;
border: 1px solid white;
background-color: #383736;
right: 100%;
left: 0;
top: 0;
bottom: 0;
z-index: -1;
-webkit-transition: right 0.15s ease;
}
#nav ul li button:hover:before {
right:0;
}
And the HTML:
<div id="nav">
<ul>
<li><button>About Me</button></li>
<li><button>Links</button></li>
<li><button>Contact Me</button></li>
</ul>
</div>
you need to set button in position:relative so pseudo use it as reference.
#nav {
float: left;
position: relative;
left: -20px;
}
#nav ul {
list-style-type: none;
}
#nav ul li button {
position:relative;
font-family: 'Roboto', sans-serif;
font-size: 15px;
color: #383736;
letter-spacing:2px;
text-transform: uppercase;
overflow: none;
cursor: pointer;
outline: 0;
background: none;
background: white;
border: 1px solid #383736;
border-radius: 3px;
padding: 7px 12px;
margin: 35px 0px;
z-index: 1;
-webkit-transition: 0.08s ease-in;
}
#nav ul li button:hover {
color: white;
}
#nav ul li button::before {
content: "";
position: absolute;
border: 1px solid white;
background-color: #383736;
right: 100%;
left: 0;
top: 0;
bottom: 0;
z-index: -1;
transition: right 0.15s ease;
}
#nav ul li button:hover:before {
right:0;
}
<div id="nav">
<ul>
<li><button>About Me</button></li>
<li><button>Links</button></li>
<li><button>Contact Me</button></li>
</ul>
</div>
I would to make my navbar on center. Tried this:
#menu {
position: relative;
height: 44px;
width: auto;
padding-left:165px;
}
But, this code does not works on large screen or zoom out. And I've tried
margin-left:auto;
margin-right:auto;
Here is my full navbar codes
#menu {
position: relative;
height: 44px;
width: auto;
margin: 0px auto;
}
#menu ul {
list-style: none;
padding: 0;
margin: 0;
line-height: 1;
}
#menu > ul {
position: relative;
display: block;
background: -moz-linear-gradient(#4F93EF, #1162CB);
background: -o-linear-gradient(#4F93EF, #1162CB);
background: -webkit-linear-gradient(#4F93EF, #1162CB);
/*border-radius: 15px 15px 0px 0px;
-moz-border-radius: 15px 15px 0px 0px;
-webkit-border: 15px 15px 0px 0px;*/
width: 1020px;
z-index: 500;
}
#menu:after,
#menu > ul:after {
content: ".";
display: block;
clear: both;
visibility: hidden;
line-height: 0;
height: 0;
}
#menu.align-right > ul > li {
float: right;
}
#menu.align-center ul {
text-align: center;
}
#menu.align-center ul ul {
text-align: left;
}
#menu > ul > li {
display: inline-block;
position: relative;
margin: 0;
padding: 0;
}
#menu > ul > #menu-button {
display: none;
}
#menu ul li a {
display: block;
font-family:Geneva, Arial, Helvetica, sans-serif;
text-decoration: none;
}
#menu > ul > li > a {
font-size: 14px;
font-weight: bold;
padding: 15px 20px;
color: #ffffff;
text-transform: uppercase;
-webkit-transition: color 0.25s ease-out;
-moz-transition: color 0.25s ease-out;
-ms-transition: color 0.25s ease-out;
-o-transition: color 0.25s ease-out;
transition: color 0.25s ease-out;
}
#menu > ul > li.has-sub > a {
padding-right: 32px;
}
#menu > ul > li:hover > a {
color: #b6b6b6;
}
#menu li.has-sub::after {
display: block;
content: "";
position: absolute;
width: 0;
height: 0;
}
#menu > ul > li.has-sub::after {
right: 15px;
top: 20px;
border: 5px solid transparent;
border-top-color: #ffffff;
}
#menu > ul > li:hover::after {
border-top-color: #b6b6b6;
}
#indicatorContainer {
position: absolute;
height: 12px;
width: 100%;
bottom: 0px;
overflow: hidden;
z-index: -1;
}
#pIndicator {
position: absolute;
height: 0;
width: 100%;
border: 12px solid transparent;
border-top-color: #0053a6;
z-index: -2;
-webkit-transition: left .25s ease;
-moz-transition: left .25s ease;
-ms-transition: left .25s ease;
-o-transition: left .25s ease;
transition: left .25s ease;
}
#cIndicator {
position: absolute;
height: 0;
width: 100%;
border: 12px solid transparent;
border-top-color: #0053a6;
top: -12px;
right: 100%;
z-index: -2;
}
#menu ul ul {
position: absolute;
left: -9999px;
top: 70px;
opacity: 0;
-webkit-transition: opacity .3s ease, top .25s ease;
-moz-transition: opacity .3s ease, top .25s ease;
-ms-transition: opacity .3s ease, top .25s ease;
-o-transition: opacity .3s ease, top .25s ease;
transition: opacity .3s ease, top .25s ease;
z-index: 1000;
}
#menu ul ul ul {
top: 37px;
padding-left: 5px;
}
#menu ul ul li {
position: relative;
}
#menu > ul > li:hover > ul {
left: auto;
top: 44px;
opacity: 1;
}
#menu.align-right > ul > li:hover > ul {
left: auto;
right: 0;
opacity: 1;
}
#menu ul ul li:hover > ul {
left: 190px;
top: 0;
opacity: 1;
}
#menu.align-right ul ul li:hover > ul {
left: auto;
right: 190px;
top: 0;
opacity: 1;
padding-right: 5px;
}
#menu ul ul li a {
width: 150px; /*ukuran kotak*/
border-bottom: 1px solid #eeeeee;
padding: 10px 20px;
font-size: 12px;
font-weight:bold;
color: #ffffff;
background: #006ad4;
-webkit-transition: all .35s ease;
-moz-transition: all .35s ease;
-ms-transition: all .35s ease;
-o-transition: all .35s ease;
transition: all .35s ease;
}
#menu.align-right ul ul li a {
text-align: right;
}
#menu ul ul li:hover > a {
background: #0160bf;
color: #b6b6b6;
}
#menu ul ul li:last-child > a,
#menu ul ul li.last > a {
border-bottom: 0;
}
#menu > ul > li > ul::after {
content: '';
border: 6px solid transparent;
width: 0;
height: 0;
border-bottom-color: #b6b6b6;
position: absolute;
top: -12px;
left: 30px;
}
#menu.align-right > ul > li > ul::after {
left: auto;
right: 30px;
}
#menu ul ul li.has-sub::after {
border: 4px solid transparent;
border-left-color: #b6b6b6;
right: 10px;
top: 12px;
-moz-transition: all .2s ease;
-ms-transition: all .2s ease;
-o-transition: all .2s ease;
transition: all .2s ease;
-webkit-transition: -webkit-transform 0.2s ease, right 0.2s ease;
}
#menu.align-right ul ul li.has-sub::after {
border-left-color: transparent;
border-right-color: #b6b6b6;
right: auto;
left: 10px;
}
#menu ul ul li.has-sub:hover::after {
border-left-color: #b6b6b6;
right: -5px;
-webkit-transform: rotateY(180deg);
-ms-transform: rotateY(180deg);
-moz-transform: rotateY(180deg);
-o-transform: rotateY(180deg);
transform: rotateY(180deg);
}
#menu.align-right ul ul li.has-sub:hover::after {
border-right-color: #b6b6b6;
border-left-color: transparent;
left: -5px;
-webkit-transform: rotateY(180deg);
-ms-transform: rotateY(180deg);
-moz-transform: rotateY(180deg);
-o-transform: rotateY(180deg);
transform: rotateY(180deg);
}
#media all and (max-width: 800px), only screen and (-webkit-min-device-pixel-ratio: 2) and (max-width: 1024px), only screen and (min--moz-device-pixel-ratio: 2) and (max-width: 1024px), only screen and (-o-min-device-pixel-ratio: 2/1) and (max-width: 1024px), only screen and (min-device-pixel-ratio: 2) and (max-width: 1024px), only screen and (min-resolution: 192dpi) and (max-width: 1024px), only screen and (min-resolution: 2dppx) and (max-width: 1024px) {
#menu {
width: auto;
}
#menu.align-center ul {
text-align: left;
}
#menu.align-right > ul > li {
float: none;
}
#menu ul {
width: auto;
}
#menu .submenuArrow,
#menu #indicatorContainer {
display: none;
}
#menu > ul {
height: auto;
display: block;
}
#menu > ul > li {
float: none;
}
#menu li,
#menu > ul > li {
display: none;
}
#menu ul ul,
#menu ul ul ul,
#menu ul > li:hover > ul,
#menu ul ul > li:hover > ul,
#menu.align-right ul ul,
#menu.align-right ul ul ul,
#menu.align-right ul > li:hover > ul,
#menu.align-right ul ul > li:hover > ul {
position: relative;
left: auto;
top: auto;
opacity: 1;
padding-left: 0;
padding-right: 0;
right: auto;
}
#menu ul .has-sub::after {
display: none;
}
#menu ul li a {
padding: 12px 20px;
}
#menu ul ul li a {
border: 0;
background: none;
width: auto;
padding: 8px 35px;
}
#menu.align-right ul ul li a {
text-align: left;
}
#menu ul ul li:hover > a {
background: none;
color: #b6b6b6;
}
#menu ul ul ul a {
padding: 8px 50px;
}
#menu ul ul ul ul a {
padding: 8px 65px;
}
#menu ul ul ul ul ul a {
padding: 8px 80px;
}
#menu ul ul ul ul ul ul a {
padding: 8px 95px;
}
#menu > ul > #menu-button {
display: block;
cursor: pointer;
}
#menu #menu-button > a {
padding: 14px 20px;
}
#menu ul.open li,
#menu > ul.open > li {
display: block;
}
#menu > ul.open > li#menu-button > a {
color: #fff;
border-bottom: 1px solid rgba(150, 150, 150, 0.1);
}
#menu ul ul::after {
display: none;
}
#menu #menu-button::after {
display: block;
content: '';
position: absolute;
height: 3px;
width: 22px;
border-top: 2px solid #ffffff;
border-bottom: 2px solid #ffffff;
right: 20px;
top: 15px;
}
#menu #menu-button::before {
display: block;
content: '';
position: absolute;
height: 3px;
width: 22px;
border-top: 2px solid #ffffff;
right: 20px;
top: 25px;
}
#menu ul.open #menu-button::after,
#menu ul.open #menu-button::before {
border-color: #fff;
}
}
I've tried margin-left auto, margin-right auto and margin 0px auto
Still does not work, any solution guys?
Need to fix the width of the parent tag and set the style="margin:0px auto;"
Your use of margin-left and margin-right is incorrect, it should be:
margin-left:auto;
margin-right:auto;
Try to use left and right with auto
#menu {
position: relative;
height: 44px;
width: auto;
margin-left:auto;
margin-right:auto;
float:none !important;
}
try the following:
#menu {
position: relative;
height: 44px;
width: 500px;
right: 0;
left: 0;
margin-right: auto;
margin-left: auto;
background-color: red;
color: white;
display: block;
}
PS: try the position as absolute or fixed also instead of relative.