Mobile Menu looks different on iPhones than Android phones - html

So this is just a plain and simple responsive menu using only CSS.
The issue is that on iPhones it looks like it will not cover the entire screen like it is supposed to. This works properly on android phones.
I am facing the issue and troubleshooting on BrowserStack. Any help is appreciated.
The domain is: https://chameleon.works/chameleonnew/
Also here is the code for the menu:
HTML:
<nav>
<input type="checkbox" id="nav" class="hidden"/>
<label for="nav" class="nav-open"><i></i><i></i><i></i></label>
<div class="nav-container">
<ul class="items">
<li class="item">
Services
</li>
<li class="item">
<a class="home-nav-a" href="/chameleonnew/about/"> About</a>
</li>
<li class="item">
<a class="home-nav-a" href="/chameleonnew/portfolio/"> Portfolio</a>
</li>
<li class="item">
<a class="home-nav-a" href="/chameleonnew/blog/"> Blog</a>
</li>
<li class="item">
<a class="home-nav-a" href="/chameleonnew/careers/"> Careers</a>
</li>
<li class="item">
<a class="home-nav-a" href="/chameleonnew/contact/"> Contact</a>
</li>
</ul>
</div>
</nav>
CSS:
a.home-nav-a{
color:#fff;
font-family: "Poppins", Sans-serif;
}
header ul {
margin-left: auto;
}
header nav {
margin-left: auto;
}
header ul li {
color: white;
text-transform: uppercase;
font-weight: 600;
font-size: 10px;
letter-spacing: 1px;
display: inline-block;
margin-left: 10px;
}
nav ul {
float: right;
}
nav ul li {
display: inline-block;
float: left;
}
nav ul li:not(:first-child) {
margin-left: 25px;
}
nav ul li a {
display: inline-block;
outline: none;
color: #1f2227;
font-size: 16px;
text-decoration: none;
letter-spacing: 0.04em;
}
nav ul li a:hover {
color: #808080;
text-decoration: none;
}
#media screen and (max-width: 560px) {
.nav-container {
position: fixed;
top: 0;
left: 0;
height: 100%;
width: 100%;
z-index: -1;
background: #232323;
opacity: 0;
transition: all 0.2s ease;
}
.nav-container ul {
position: absolute;
top: 50%;
transform: translateY(-50%);
width: 100%;
}
.nav-container ul li {
display: block;
float: none;
width: 100%;
text-align: right;
margin-bottom: 10px;
}
.nav-container ul li:nth-child(1) a {
transition-delay: 0.2s;
}
.nav-container ul li:nth-child(2) a {
transition-delay: 0.3s;
}
.nav-container ul li:nth-child(3) a {
transition-delay: 0.4s;
}
.nav-container ul li:nth-child(4) a {
transition-delay: 0.5s;
}
.nav-container ul li:not(:first-child) {
margin-left: 0;
}
.nav-container ul li a {
padding: 10px 25px;
opacity: 0;
color: #fff;
font-size: 24px;
font-weight: 600;
transform: translateY(-20px);
transition: all 0.2s ease;
}
.nav-open {
position: fixed;
right: 10px;
top: 20px;
display: block;
width: 48px;
height: 48px;
cursor: pointer;
z-index: 9999;
border-radius: 50%;
}
.nav-open i {
display: block;
width: 20px;
height: 2px;
background: #fff;
border-radius: 2px;
margin-left: 14px;
}
.nav-open i:nth-child(1) {
margin-top: 16px;
}
.nav-open i:nth-child(2) {
margin-top: 4px;
opacity: 1;
}
.nav-open i:nth-child(3) {
margin-top: 4px;
}
}
#nav:checked + .nav-open {
transform: rotate(45deg);
}
#nav:checked + .nav-open i {
background: #fff;
transition: transform 0.2s ease;
}
#nav:checked + .nav-open i:nth-child(1) {
transform: translateY(6px) rotate(180deg);
}
#nav:checked + .nav-open i:nth-child(2) {
opacity: 0;
}
#nav:checked + .nav-open i:nth-child(3) {
transform: translateY(-6px) rotate(90deg);
}
#nav:checked ~ .nav-container {
z-index: 9990!important;
opacity: 1;
}
#nav:checked ~ .nav-container ul li a {
opacity: 1;
transform: translateY(0);
}
.hidden {
display: none;
}

Related

Dropdown Content

im trying to replicate the "Page" Dropdown Animation with the icon, but im having difficulties, someone know how to make it similar to the "Page scroll one"?
Im leaving the code, you can find the Button than im trying to replicate with the icon dropdown and where i am at the moment.
Here is the HTML CODE:
<!-- Google Font -->
<link href="https://fonts.googleapis.com/css2?family=Play:wght#400;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Josefin+Sans:wght#300;400;500;600;700&display=swap"
rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css">
<header class="header">
<div class="container">
<div class="row">
<div class="col-lg-2">
<div class="header__logo">
<img src="img/logo.png" alt="">
</div>
</div>
<div class="col-lg-10">
<div class="header__nav__option">
<nav class="header__nav__menu mobile-menu">
<ul>
<li>Pages
<ul class="dropdown">
<li>About</li>
<li>Portfolio</li>
<li>Blog</li>
<li>Blog Details</li>
</ul>
</li>
</ul>
</nav>
<div class="header__nav__settings">
<ul>
<a href="#"><i class="fa fa-gear"></i>
<ul class="dropdown">
<li>Portfolio</li>
<li>Blog</li>
<li>Blog Details</li>
</ul>
</a>
</ul>
</div>
</div>
</div>
</div>
<div id="mobile-menu-wrap"></div>
</div>
</header>
Here is the css
.header {
position: absolute;
left: 0;
top: 0;
width: 100%;
background: transparent;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
z-index: 9;
}
.header__nav__menu {
display: inline-block;
margin-right: 45px;
}
.header__nav__menu ul li {
list-style: none;
display: inline-block;
margin-right: 45px;
position: relative;
}
.header__nav__menu ul li.active a:after {
-webkit-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
}
.header__nav__menu ul li:hover a:after {
-webkit-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
}
.header__nav__menu ul li:hover .dropdown {
top: 34px;
opacity: 1;
visibility: visible;
}
.header__nav__menu ul li:last-child {
margin-right: 0;
}
.header__nav__menu ul li .dropdown {
position: absolute;
left: 0;
top: 60px;
width: 140px;
background: black;
text-align: left;
padding: 2px 0;
z-index: 9;
opacity: 0;
visibility: hidden;
-webkit-transition: all, 0.3s;
-o-transition: all, 0.3s;
transition: all, 0.3s;
}
.header__nav__menu ul li .dropdown li {
display: block;
margin-right: 0;
}
.header__nav__menu ul li .dropdown li a {
font-size: 14px;
color: white;
padding: 8px 20px;
text-transform: capitalize;
}
.header__nav__menu ul li .dropdown li a:after {
display: none;
}
.header__nav__menu ul li a {
font-size: 15px;
font-family: "Play", sans-serif;
color: black;
display: block;
text-transform: uppercase;
position: relative;
padding: 6px 0;
}
.header__nav__menu ul li a:after {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 2px;
background: #00bfe7;
content: "";
-webkit-transform: scale(0);
-ms-transform: scale(0);
transform: scale(0);
-webkit-transition: all, 0.3s;
-o-transition: all, 0.3s;
transition: all, 0.3s;
}
/*Settings Dropdown*/
.header__nav__settings {
display: inline-block;
position: relative;
padding-left: 50px;
}
.header__nav__settings:before {
position: absolute;
left: 0;
top: 4px;
height: 13px;
width: 2px;
background: rgba(225, 225, 225, 0.2);
content: "";
}
.header__nav__settings a {
color: black;
font-size: 15px;
}
.header__nav__settings a:last-child {
margin-right: 0;
}
.slicknav_menu {
display: none;
}
/*Settings Dropdown Content*/
.header__nav__settings ul a {
list-style: none;
display: inline-block;
margin-right: 45px;
position: relative;
}
.header__nav__settings ul a i.active a:after {
-webkit-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
}
.header__nav__settings ul a i:hover a:after {
-webkit-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
}
.header__nav__settings ul:hover .dropdown {
top: 34px;
opacity: 1;
visibility: visible;
}
.header__nav__settings ul .dropdown li a {
font-size: 14px;
color: white;
padding: 8px 20px;
text-transform: capitalize;
}
.header__nav__settings ul .dropdown {
position: absolute;
left: 0;
top: 60px;
width: 140px;
background: black;
text-align: left;
padding: 2px 0;
z-index: 9;
opacity: 0;
visibility: hidden;
-webkit-transition: all, 0.3s;
-o-transition: all, 0.3s;
transition: all, 0.3s;
}
.header__nav__settings ul .dropdown li {
display: block;
margin-right: 0;
}
.header__nav__settings ul li .dropdown li a {
font-size: 14px;
color: white;
padding: 8px 20px;
text-transform: capitalize;
}
.header__nav__settings ul a .dropdown li a:after {
display: none;
}
.header__nav__settings ul li a {
font-size: 15px;
font-family: "Play", sans-serif;
color: black;
display: block;
text-transform: uppercase;
position: relative;
padding: 6px 0;
}
.header__nav__settings ul li a:after {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 2px;
background: #00bfe7;
content: "";
-webkit-transform: scale(0);
-ms-transform: scale(0);
transform: scale(0);
-webkit-transition: all, 0.3s;
-o-transition: all, 0.3s;
transition: all, 0.3s;
}
Thank u in adavnce for the help!!!
Your code is wrong because your wrote <i> instead of <li> and you didn't close the <a> where you should. This is the code corrected:
.header {
position: absolute;
left: 0;
top: 0;
width: 100%;
background: transparent;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
z-index: 9;
}
.header__nav__menu {
display: inline-block;
margin-right: 45px;
}
.header__nav__menu ul li {
list-style: none;
display: inline-block;
margin-right: 45px;
position: relative;
}
.header__nav__menu ul li.active a:after {
-webkit-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
}
.header__nav__menu ul li:hover a:after {
-webkit-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
}
.header__nav__menu ul li:hover .dropdown {
top: 34px;
opacity: 1;
visibility: visible;
}
.header__nav__menu ul li:last-child {
margin-right: 0;
}
.header__nav__menu ul li .dropdown {
position: absolute;
left: 0;
top: 60px;
width: 140px;
background: black;
text-align: left;
padding: 2px 0;
z-index: 9;
opacity: 0;
visibility: hidden;
-webkit-transition: all, 0.3s;
-o-transition: all, 0.3s;
transition: all, 0.3s;
}
.header__nav__menu ul li .dropdown li {
display: block;
margin-right: 0;
}
.header__nav__menu ul li .dropdown li a {
font-size: 14px;
color: white;
padding: 8px 20px;
text-transform: capitalize;
}
.header__nav__menu ul li .dropdown li a:after {
display: none;
}
.header__nav__menu ul li a {
font-size: 15px;
font-family: "Play", sans-serif;
color: black;
display: block;
text-transform: uppercase;
position: relative;
padding: 6px 0;
}
.header__nav__menu ul li a:after {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 2px;
background: #00bfe7;
content: "";
-webkit-transform: scale(0);
-ms-transform: scale(0);
transform: scale(0);
-webkit-transition: all, 0.3s;
-o-transition: all, 0.3s;
transition: all, 0.3s;
}
/*Settings Dropdown*/
.header__nav__settings {
display: inline-block;
position: relative;
padding-left: 50px;
}
.header__nav__settings:before {
position: absolute;
left: 0;
top: 4px;
height: 13px;
width: 2px;
background: rgba(225, 225, 225, 0.2);
content: "";
}
.header__nav__settings a {
color: black;
font-size: 15px;
}
.header__nav__settings a:last-child {
margin-right: 0;
}
.slicknav_menu {
display: none;
}
/*Settings Dropdown Content*/
.header__nav__settings ul a {
list-style: none;
display: inline-block;
margin-right: 45px;
position: relative;
}
.header__nav__settings ul a i.active a:after {
-webkit-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
}
.header__nav__settings ul a i:hover a:after {
-webkit-transform: scale(1);
-ms-transform: scale(1);
transform: scale(1);
}
.header__nav__settings ul:hover .dropdown {
top: 34px;
opacity: 1;
visibility: visible;
}
.header__nav__settings ul .dropdown li a {
font-size: 14px;
color: white;
padding: 8px 20px;
text-transform: capitalize;
}
.header__nav__settings ul .dropdown {
position: absolute;
left: 0;
top: 60px;
width: 140px;
background: black;
text-align: left;
padding: 2px 0;
z-index: 9;
opacity: 0;
visibility: hidden;
-webkit-transition: all, 0.3s;
-o-transition: all, 0.3s;
transition: all, 0.3s;
}
.header__nav__settings ul .dropdown li {
display: block;
margin-right: 0;
}
.header__nav__settings ul li .dropdown li a {
font-size: 14px;
color: white;
padding: 8px 20px;
text-transform: capitalize;
}
.header__nav__settings ul a .dropdown li a:after {
display: none;
}
.header__nav__settings ul li a {
font-size: 15px;
font-family: "Play", sans-serif;
color: black;
display: block;
text-transform: uppercase;
position: relative;
padding: 6px 0;
}
.header__nav__settings ul li a:after {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 2px;
background: #00bfe7;
content: "";
-webkit-transform: scale(0);
-ms-transform: scale(0);
transform: scale(0);
-webkit-transition: all, 0.3s;
-o-transition: all, 0.3s;
transition: all, 0.3s;
}
<!-- Google Font -->
<link href="https://fonts.googleapis.com/css2?family=Play:wght#400;700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Josefin+Sans:wght#300;400;500;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css">
<header class="header">
<div class="container">
<div class="row">
<div class="col-lg-2">
<div class="header__logo">
<img src="img/logo.png" alt="">
</div>
</div>
<div class="col-lg-10">
<div class="header__nav__option">
<nav class="header__nav__menu mobile-menu">
<ul>
<li>Pages
<ul class="dropdown">
<li>About</li>
<li>Portfolio</li>
<li>Blog</li>
<li>Blog Details</li>
</ul>
</li>
</ul>
</nav>
<div class="header__nav__settings">
<ul>
<li class="fa fa-gear">
<ul class="dropdown">
<li>Portfolio</li>
<li>Blog</li>
<li>Blog Details</li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</div>
<div id="mobile-menu-wrap"></div>
</div>
</header>

How can I add another submenu under the submenu?

I tried to use the same pattern in creating submenu, and its displaying but the problem is its already showing when I only trying to view the submenu
<ul class="nav-links">
<li>
<div class="iocn-link">
<a href="#">
<i class='bx bx-collection'></i>
<span class="link_name">Patient Information Module</span>
</a>
<i class='bx bxs-chevron-down arrow'></i>
</div>
<ul class="sub-menu">
<li><a class="link_name" href="#">Patient Information</a></li>
<li>Patient</li>
<li>Dental</li>
<li>Immunization</li>
<li>Pediatric</li>
<li>
<div class="iocn-link">
<a href="#">
<i class='bx bx-collection'></i>
<span class="link_name">Pediatric</span>
</a>
<i class='bx bxs-chevron-down arrow'></i>
</div>
<ul class="sub-menu">
<li><a class="link_name" href="#">Immunization</a></li>
<li>Deworming</li>
<li>Vitamins/Suppliments</li>
</ul>
</li>
<li>TB Dots</li>
<li>OB</li>
</ul>
</li>
Please refer this :
Use JavaScript and CSS for hide and show submenu on click or hover
document.addEventListener('click', function(e) {
e = e || window.event;
console.log(e);
var target = e.target || e.srcElement;
console.log(target);
if (target.parentElement.className.indexOf('has-submenu') > -1) {
e.target.classList.toggle('open');
}
}, false);
#menu {
background: #343434;
color: #eee;
height: 35px;
border-bottom: 4px solid #eeeded
}
#menu ul,
#menu li {
margin: 0 0;
padding: 0 0;
list-style: none
}
#menu ul {
height: 35px
}
#menu li {
float: left;
display: inline;
position: relative;
font: bold 12px Arial;
text-shadow: 0 -1px 0 #000;
border-right: 1px solid #444;
border-left: 1px solid #111;
text-transform: uppercase
}
#menu li:first-child {
border-left: none
}
#menu a {
display: block;
line-height: 35px;
padding: 0 14px;
text-decoration: none;
color: #eee;
}
#menu li:hover > a,
#menu li a:hover {
background: #111
}
#menu input {
display: none;
margin: 0 0;
padding: 0 0;
width: 80px;
height: 35px;
opacity: 0;
cursor: pointer
}
#menu label {
font: bold 30px Arial;
display: none;
width: 35px;
height: 36px;
line-height: 36px;
text-align: center
}
#menu label span {
font-size: 12px;
position: absolute;
left: 35px
}
#menu ul.menus {
height: auto;
width: 180px;
background: #111;
position: absolute;
z-index: 99;
display: none;
border: 0;
}
#menu ul.menus li {
display: block;
width: 100%;
font: 12px Arial;
text-transform: none;
}
#menu li:hover ul.menus {
display: block
}
#menu a.home {
background: #c00;
}
#menu a.prett {
padding: 0 27px 0 14px
}
#menu a.prett::after {
content: "";
width: 0;
height: 0;
border-width: 6px 5px;
border-style: solid;
border-color: #eee transparent transparent transparent;
position: absolute;
top: 15px;
right: 9px
}
#menu a.prett.open::after {
content: "";
width: 0;
height: 0;
border-width: 6px 5px;
border-style: solid;
border-color: transparent transparent #eee transparent;
position: absolute;
top: 9px;
right: 9px
}
#menu ul.menus a:hover {
background: #333;
}
#menu ul.menus .submenu {
display: none;
position: absolute;
left: 180px;
background: #111;
top: 0;
width: 180px;
}
#menu ul.menus .submenu li {
background: #111;
}
#menu ul.menus .has-submenu a.open ~ .submenu {
display: block;
}
<nav>
<ul id='menu'>
<li><a class='home' href='/'>Home</a></li>
<li><a class='prett' href='#' title='Menu'>Menu</a>
<ul class='menus'>
<li class='has-submenu'><a class='prett' title='Dropdown 1'>Dropdown 1 + Sub Menu</a>
<ul class='submenu'>
<li>Sub Menu</li>
<li>Sub Menu 2</li>
<li>Sub Menu 3</li>
</ul>
</li>
<li><a href='#' title='Dropdown 2'>Dropdown 2</a></li>
<li><a href='#' title='Dropdown 3'>Dropdown 3</a></li>
</ul>
</li>
</ul>
</nav>
let arrow = document.querySelectorAll(".arrow");
for (var i = 0; i < arrow.length; i++) {
arrow[i].addEventListener("click", (e) => {
let arrowParent = e.target.parentElement.parentElement; //selecting main parent of arrow
arrowParent.classList.toggle("showMenu");
});
}
let sidebar = document.querySelector(".sidebar");
let sidebarBtn = document.querySelector(".bx-menu");
console.log(sidebarBtn);
sidebarBtn.addEventListener("click", () => {
sidebar.classList.toggle("close");
});
/* Google Fonts Import Link */
#import url('https://fonts.googleapis.com/css2?family=Poppins:wght#300;400;500;600;700&display=swap');
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Poppins', sans-serif;
}
.sidebar {
position: fixed;
top: 0;
left: 0;
height: 100%;
width: 300px;
background: #11101d;
z-index: 100;
transition: all 0.5s ease;
}
.sidebar.close {
width: 78px;
}
.sidebar .logo-details {
height: 60px;
width: 100%;
display: flex;
align-items: center;
}
.sidebar .logo-details i {
font-size: 30px;
color: #fff;
height: 50px;
min-width: 78px;
text-align: center;
line-height: 50px;
}
.sidebar .logo-details .logo_name {
font-size: 22px;
color: #fff;
font-weight: 600;
transition: 0.3s ease;
transition-delay: 0.1s;
}
.sidebar.close .logo-details .logo_name {
transition-delay: 0s;
opacity: 0;
pointer-events: none;
}
.sidebar .nav-links {
height: 100%;
padding: 30px 0 150px 0;
overflow: auto;
}
.sidebar.close .nav-links {
overflow: visible;
}
.sidebar .nav-links::-webkit-scrollbar {
display: none;
}
.sidebar .nav-links li {
position: relative;
list-style: none;
transition: all 0.4s ease;
}
.sidebar .nav-links li:hover {
background: #1d1b31;
}
.sidebar .nav-links li .iocn-link {
display: flex;
align-items: center;
justify-content: space-between;
}
.sidebar.close .nav-links li .iocn-link {
display: block
}
.sidebar .nav-links li i {
height: 50px;
min-width: 78px;
text-align: center;
line-height: 50px;
color: #fff;
font-size: 20px;
cursor: pointer;
transition: all 0.3s ease;
}
.sidebar .nav-links li.showMenu i.arrow {
transform: rotate(-180deg);
}
.sidebar.close .nav-links i.arrow {
display: none;
}
.sidebar .nav-links li a {
display: flex;
align-items: center;
text-decoration: none;
}
.sidebar .nav-links li a .link_name {
font-size: 15px;
font-weight: 300;
color: #fff;
transition: all 0.4s ease;
}
.sidebar.close .nav-links li a .link_name {
opacity: 0;
pointer-events: none;
}
.sidebar .nav-links li .Menu {
padding: 6px 6px 14px 80px;
margin-top: -10px;
background: #1d1b31;
display: none;
}
.sidebar .nav-links li.showMenu .Menu {
display: block;
}
.sub-menu2 {
display: none;
}
.hover-me:hover .sub-menu2 {
display: block;
}
.sidebar .nav-links li .Menu a {
color: #fff;
font-size: 14px;
padding: 5px 0;
white-space: nowrap;
opacity: 0.6;
transition: all 0.3s ease;
}
.sidebar .nav-links li .Menu a:hover {
opacity: 1;
}
.sidebar.close .nav-links li .Menu {
position: absolute;
left: 100%;
top: -10px;
margin-top: 0;
padding: 10px 20px;
border-radius: 0 6px 6px 0;
opacity: 0;
display: block;
pointer-events: none;
transition: 0s;
}
.sidebar.close .nav-links li:hover .Menu {
top: 0;
opacity: 1;
pointer-events: auto;
transition: all 0.4s ease;
}
.sidebar .nav-links li .Menu .link_name {
display: none;
}
.sidebar.close .nav-links li .Menu .link_name {
font-size: 15px;
opacity: 1;
display: block;
}
.sidebar .nav-links li .Menu.blank {
opacity: 1;
pointer-events: auto;
padding: 3px 20px 6px 16px;
opacity: 0;
pointer-events: none;
}
.sidebar .nav-links li:hover .Menu.blank {
top: 50%;
transform: translateY(-50%);
}
.sidebar .profile-details {
position: fixed;
bottom: 0;
width: 260px;
display: flex;
align-items: center;
justify-content: space-between;
background: #1d1b31;
padding: 12px 0;
transition: all 0.5s ease;
}
.sidebar.close .profile-details {
background: none;
}
.sidebar.close .profile-details {
width: 78px;
}
.sidebar .profile-details .profile-content {
display: flex;
align-items: center;
}
.sidebar .profile-details img {
height: 52px;
width: 52px;
object-fit: cover;
border-radius: 16px;
margin: 0 14px 0 12px;
background: #1d1b31;
transition: all 0.5s ease;
}
.sidebar.close .profile-details img {
padding: 10px;
}
.sidebar .profile-details .profile_name,
.sidebar .profile-details .job {
color: #fff;
font-size: 15px;
font-weight: 300;
white-space: nowrap;
}
.sidebar.close .profile-details i,
.sidebar.close .profile-details .profile_name,
.sidebar.close .profile-details .job {
display: none;
}
.sidebar .profile-details .job {
font-size: 12px;
}
.home-section {
position: relative;
background: #E4E9F7;
height: 100vh;
left: 260px;
width: calc(100% - 260px);
transition: all 0.5s ease;
}
.sidebar.close~.home-section {
left: 78px;
width: calc(100% - 78px);
}
.home-section .home-content {
height: 60px;
display: flex;
align-items: center;
}
.home-section .home-content .bx-menu,
.home-section .home-content .text {
color: #11101d;
font-size: 35px;
}
.home-section .home-content .bx-menu {
margin: 0 15px;
cursor: pointer;
}
.home-section .home-content .text {
font-size: 26px;
font-weight: 600;
}
#media (max-width: 400px) {
.sidebar.close .nav-links li .sub-menu {
display: none;
}
.sidebar {
width: 78px;
}
.sidebar.close {
width: 0;
}
.home-section {
left: 78px;
width: calc(100% - 78px);
z-index: 100;
}
.sidebar.close~.home-section {
width: 100%;
left: 0;
}
}
<li>
<div class="iocn-link">
<a href="#">
<i class='bx bx-collection'></i>
<span class="link_name">Patient Information Module</span>
</a>
<i class='bx bxs-chevron-down arrow'></i>
</div>
<ul class="Menu">
<li><a class="link_name" href="#">Patient Information</a></li>
<li>Patient</li>
<li>Dental</li>
<li>Immunization</li>
<li class="hover-me"><a href="#">Pediatric
<i class='bx bxs-chevron-down arrow' ></i>
</a>
<ul class="sub-menu2">
<li><a class="link_name" href="#">Pediatric</a></li>
<li>Immunization</li>
<li>Deworming</li>
<li>Vitamins/Suppliments</li>
</ul>
</li>
<li>TB Dots</li>
<li class="hover-me"><a href="#">OB
<i class='bx bxs-chevron-down arrow' ></i>
</a>
<ul class="sub-menu2">
<li><a class="link_name" href="#">OB</a></li>
<li>Pre-Natal</li>
<li>Post-Natal</li>
<li>Family Planning</li>
</ul>
</li>
</ul>
</li>
This is my updated code

How to make a navigation menu item with symmetrical background

I'm trying to get the background to each nav link fixed. I want it to be uniform behind each link, meaning equal on both left and right side.
Link to the actual webpage.
See the code below the picture.
Thanks.
<div class="top-nav">
<span class="menu"><img src="images/menu.png" alt=""></span>
<ul class="nav1" style="margin-top: .5em;">
<li class="hvr-sweep-to-bottom active">Home
</li>
<li class="hvr-sweep-to-bottom">Fleet Management
<ul class="level_1">
<li>Basic
</li>
<li>Basic Plus
</li>
<li>Ultra
</li>
<li>Ultra Plus
</li>
</ul>
</li>
<li class="hvr-sweep-to-bottom">Broker Agency
</li>
<li class="hvr-sweep-to-bottom">Maintenance
</li>
<li class="hvr-sweep-to-bottom">Drivers
</li>
<li class="hvr-sweep-to-bottom">Contact
</li>
<div class="clearfix"></div>
</ul>
And the CSS
.top-nav {
float: right;
width: 80%;
position: absolute;
left: 27%;
top: 20%;
}
.top-nav ul {
padding: 0;
margin: 0;
}
.top-nav ul li {
display: inline-block;
margin-right: .4em;
float: left;
position: relative;
}
.top-nav ul li.active {
background: #bb1e10;
}
.top-nav ul li a {
color: #FFF;
font-size: 18px;
margin-right: .4em;
float: left;
padding: 1em 0em 1em 1.4em;
text-align: center;
width: 79%;
}
.top-nav ul li a i {
display: block;
margin-top: 1em;
color: #FFF;
font-size: 11px;
font-style: italic;
}
.top-nav ul ul {
display: none;
left: 0;
float: left;
position: relative;
}
.top-nav ul ul li {
float: none;
width: 200px;
z-index: 1;
}
.top-nav ul ul li a {
padding: 5px 5px;
}
.top-nav ul li:hover > ul {
display: block;
}
/* Sweep To Bottom */
.hvr-sweep-to-bottom {
display: inline-block;
vertical-align: middle;
-webkit-transform: translateZ(0);
-o-transform: translateZ(0);
-moz-transform: translateZ(0);
-ms-transform: translateZ(0);
transform: translateZ(0);
box-shadow: 0 0 1px rgba(0, 0, 0, 0);
-webkit-backface-visibility: hidden;
-o-backface-visibility: hidden;
-moz-backface-visibility: hidden;
-ms-backface-visibility: hidden;
backface-visibility: hidden;
-moz-osx-font-smoothing: grayscale;
-ms-osx-font-smoothing: grayscale;
-o-osx-font-smoothing: grayscale;
position: relative;
-webkit-transition-property: color;
-o-transition-property: color;
-moz-transition-property: color;
-ms-transition-property: color;
transition-property: color;
-webkit-transition-duration: 0.3s;
-o-transition-duration: 0.3s;
-moz-transition-duration: 0.3s;
-ms-transition-duration: 0.3s;
transition-duration: 0.3s;
}
.hvr-sweep-to-bottom:before {
content: "";
position: absolute;
z-index: -1;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: #bb1e10;
-webkit-transform: scaleY(0);
-o-transform: scaleY(0);
-moz-transform: scaleY(0);
-ms-transform: scaleY(0);
transform: scaleY(0);
-webkit-transform-origin: 50% 0;
-o-transform-origin: 50% 0;
-moz-transform-origin: 50% 0;
-ms-transform-origin: 50% 0;
transform-origin: 50% 0;
-webkit-transition-property: transform;
-o-transition-property: transform;
-moz-transition-property: transform;
-ms-transition-property: transform;
transition-property: transform;
-webkit-transition-duration: 0.3s;
-o-transition-duration: 0.3s;
-moz-transition-duration: 0.3s;
-ms-transition-duration: 0.3s;
transition-duration: 0.3s;
-webkit-transition-timing-function: ease-out;
-o-transition-timing-function: ease-out;
-moz-transition-timing-function: ease-out;
-ms-transition-timing-function: ease-out;
transition-timing-function: ease-out;
}
.hvr-sweep-to-bottom:hover,
.hvr-sweep-to-bottom:focus,
.hvr-sweep-to-bottom:active {
color: white;
}
.hvr-sweep-to-bottom:hover:before,
.hvr-sweep-to-bottom:focus:before,
.hvr-sweep-to-bottom:active:before {
-webkit-transform: scaleY(1);
transform: scaleY(1);
}
/*---*/
You have added some JavaScript as well (for animations and swipe downs). I was able to mimic something, which doesn't have animations, but works as expected. Have a look here in the full screen:
* {
margin: 0;
padding: 0;
list-style: none;
box-sizing: border-box;
font-family: 'Segoe UI';
}
a {
text-decoration: none;
}
.nav {
display: block;
}
.nav > li {
display: inline-block;
position: relative;
}
.nav > li:hover,
.nav > li.active {
background-color: #f00;
color: #fff;
}
.nav a {
display: block;
padding: 10px;
color: inherit;
}
.nav ul {
display: none;
position: absolute;
left: 0;
right: 0;
background-color: #f00;
color: #fff;
}
.nav > li:hover ul {
display: block;
}
<ul class="nav">
<li class="hvr-sweep-to-bottom active">
Home
</li>
<li class="hvr-sweep-to-bottom">
Fleet Management
<ul>
<li>Basic</li>
<li>Basic Plus</li>
<li>Ultra</li>
<li>Ultra Plus</li>
</ul>
</li>
<li class="hvr-sweep-to-bottom">
Broker Agency
</li>
<li class="hvr-sweep-to-bottom">
Maintenance
</li>
<li class="hvr-sweep-to-bottom">
Drivers
</li>
<li class="hvr-sweep-to-bottom">
Contact
</li>
</ul>
Update
To fix your issue, please add this to the bottom of the style.css:
.nav {
display: block;
margin: 25px;
float: left;
}
.nav > li {
display: inline-block;
position: relative;
}
.nav > li:hover,
.nav > li.active {
background-color: #f00;
color: #fff;
}
.nav a {
display: block;
padding: 10px;
color: #fff;
}
.nav ul {
display: none;
position: absolute;
left: 0;
right: 0;
background-color: #f00;
color: #fff;
z-index: 1;
}
.nav > li:hover ul {
display: block;
}
So this gives an output like this:

DropDown-Menu should stay opend after onClick

My Homepage-Menu-Point "Software" should stay opened if you click on it!
See on my Test-Homepage!
I've tested to add "li:focus" and "li:active" to my lowermost CSS-Tag, but nothing worked. I also tried it with jQuery, without success!
The HTML-Code:
<nav id="cNav">
<div class="Nav">
<ul>
<li>G</li>
<li>Home</li>
<li>Software
<ul>
<li>Android</li>
<li>Windows</li>
</ul>
</li>
<li>Über</li>
</ul>
</div>
</nav>
The CSS-Code:
#cNav {
background-color: rgb(5, 90, 160);
margin: 0;
padding: 0;
width: 100%;
}
.Nav {
font-weight: bold;
font-size: 22pt;
margin: 0;
padding: 0;
}
.Nav ul {
padding: 0;
margin-top: 0;
margin-bottom: 0;
position: relative;
width: 100%;
text-align: center;
}
.Nav ul li {
display: inline-block;
position: relative;
padding-left: 2em;
padding-right: 2em;
padding-top: 0.4em;
padding-bottom: 0.4em;
}
.Nav ul li a {
outline: 0;
color: white;
position: relative;
text-decoration: none;
transition: color 0.3s;
}
.Nav ul li a::after {
position: absolute;
top: 100%;
left: 0;
width: 100%;
height: 4px;
background: white;
content: '';
opacity: 0;
-webkit-transition: opacity 0.3s, -webkit-transform 0.3s;
-moz-transition: opacity 0.3s, -moz-transform 0.3s;
transition: opacity 0.3s, transform 0.3s;
-webkit-transform: translateY(10px);
-moz-transform: translateY(10px);
transform: translateY(10px);
margin: 0;
}
.Nav ul li a:hover::after {
opacity: 1;
-webkit-transform: translateY(0px);
-moz-transform: translateY(0px);
transform: translateY(0px);
}
.Nav ul ul {
display: none;
white-space: nowrap;
position: absolute;
text-align: center;
top: 100%;
margin-left: -5.3em;
}
.Nav ul ul li {
background-color: rgb(5, 90, 160);
border-top: medium solid rgba(0,115,209,1.00);
margin-right: -1em;
}
.Nav ul li:hover > ul {
display: block;
}
If you want your Homepage-Menu-Point "Software" staying opened if you click on it, and you want to use jQuery, this might be a possible solution:
Add an id to the li with software:
<li id="software">Software
Then you can use this to set the css display property of the ul to block:
$(document).ready(function() {
$("#software ul").click(function() {
$(this).css("display", "block");
});
});
Snippet:
$(document).ready(function() {
$("#software ul").click(function() {
$(this).css("display", "block");
});
});
#cNav {
background-color: rgb(5, 90, 160);
margin: 0;
padding: 0;
width: 100%;
}
.Nav {
font-weight: bold;
font-size: 22pt;
margin: 0;
padding: 0;
}
.Nav ul {
padding: 0;
margin-top: 0;
margin-bottom: 0;
position: relative;
width: 100%;
text-align: center;
}
.Nav ul li {
display: inline-block;
position: relative;
padding-left: 2em;
padding-right: 2em;
padding-top: 0.4em;
padding-bottom: 0.4em;
}
.Nav ul li a {
outline: 0;
color: white;
position: relative;
text-decoration: none;
transition: color 0.3s;
}
.Nav ul li a::after {
position: absolute;
top: 100%;
left: 0;
width: 100%;
height: 4px;
background: white;
content: '';
opacity: 0;
-webkit-transition: opacity 0.3s, -webkit-transform 0.3s;
-moz-transition: opacity 0.3s, -moz-transform 0.3s;
transition: opacity 0.3s, transform 0.3s;
-webkit-transform: translateY(10px);
-moz-transform: translateY(10px);
transform: translateY(10px);
margin: 0;
}
.Nav ul li a:hover::after {
opacity: 1;
-webkit-transform: translateY(0px);
-moz-transform: translateY(0px);
transform: translateY(0px);
}
.Nav ul ul {
display: none;
white-space: nowrap;
position: absolute;
text-align: center;
top: 100%;
margin-left: -5.3em;
}
.Nav ul ul li {
background-color: rgb(5, 90, 160);
border-top: medium solid rgba(0,115,209,1.00);
margin-right: -1em;
}
.Nav ul li:hover > ul {
display: block;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<nav id="cNav">
<div class="Nav">
<ul>
<li>G</li>
<li>Home</li>
<li id="software">Software
<ul>
<li>Android</li>
<li>Windows</li>
</ul>
</li>
<li>Über</li>
</ul>
</div>
</nav>

Creating a Drop-Up Menu

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>