Dropdown Content - html

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>

Related

Mobile Menu looks different on iPhones than Android phones

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;
}

How can i change mobile menu one scroll to multiple pages?

I have one page scroll menu,but i've changed that in multiple page.These kind of menu is working on desktop,but is not working on mobile version.How can I change code css or html because in mobile version when i click on menu and close it anywhere i clicked redirectg me to another page.
.mobile-menu {
display: block;
width: 18%;
right: -20%;
height: 100%;
background: rgba(1, 16, 25, 0.67);
position: fixed;
z-index: 9998;
transition: 0.6s ease;
top: 0;
opacity: 0;
}
.mobile-menu ul {
position: relative;
top: 20%;
padding: 0;
}
.mobile-menu ul li {
list-style: none;
margin-bottom: 2em;
display: block;
}
.mobile-menu ul li a {
width: 100%;
margin: 0 auto;
display: block;
text-align: center;
text-decoration: none;
color: #fff;
font-size: 1em;
font-weight: bold;
overflow: hidden;
position: relative;
padding: 1em 0;
text-transform: uppercase;
letter-spacing: 3px;
}
.open > ul.dropdown-menu.agile_short_dropdown{
display: block;
transform: none !important;
min-width: 65%;
border: none;
box-shadow: none;
border-radius: 0;
left: 18%;
}
.open > ul.dropdown-menu.agile_short_dropdown li{
margin:0 !important;
}
ul.dropdown-menu.agile_short_dropdown > li > a:hover{
background: none;
}
.mobile-menu ul li a:after {
content: '';
background: #191143;
width: 100%;
height: 100%;
position: absolute;
right: -100%;
top: 0;
z-index: -1;
transition: 0.4s ease;
}
.mobile-menu ul li a:hover,.mobile-menu ul li.active a {
color: #fff;
}
.mobile-menu ul li a:hover:after,.mobile-menu ul li.active a:after {
right: 0;
}
li.dropdown.act a.w3_icons_act {
background: #0e0e0e;
color: #fff;
}
.mobile-menu img {
position: absolute;
width: 150px;
display: block;
left: 50%;
top: 3rem;
transform: translatex(-50%);
-webkit-transform: translatex(-50%);
-moz-transform: translatex(-50%);
-o-transform: translatex(-50%);
-ms-transform: translatex(-50%);
padding: 0;
text-align: center;
}
.mobile-menu--open {
opacity: 1;
right:0%;
}
.dropdown.active.open a ul.dropdown-menu.agile_short_dropdown li a.w3_icon_1:after{
background:none !important;
<div class="center-container">
<div class="w3_agile_header">
<div class="w3_menu">
<div class="agileits_w3layouts_banner_info">
</div>
<div class="mobile-nav-button">
<div class="mobile-nav-button__line"></div>
<div class="mobile-nav-button__line"></div>
<div class="mobile-nav-button__line"></div>
</div>
<nav class="mobile-menu">
<ul>
<li><a href="https://ioanasandu.ro/online/web/index.html" class="hover" >Despre mine</a></li>
<li>Repertoriu</li>
<li>Discografie</li>
<li>Evenimente</li>
<li>Foto</li>
<li>Video</li>
<li>Contact</li>
</ul>
</nav>
</div>
<div class="clearfix"></div>
</div>
Can anyone help me?

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>

Pure HTML/CSS list menu with "next" arrows

I am trying to generate a pure HTML/CSS menu with arrows pointing to the right. As long as the active state is the first tab everything looks fine (http://jsfiddle.net/q03wma6u/). But when the active class moves to the second tab, the border and the arrow are not positioned togehter (http://jsfiddle.net/q03wma6u/1/).
Is there a way to generate this menu just using HTML/CSS?
ol.tabs {
-moz-transition: opacity 0.3s linear;
-o-transition: opacity 0.3s linear;
-webkit-transition: opacity 0.3s linear;
transition: opacity 0.3s linear;
margin: 0;
padding: 0;
list-style: none;
display: table;
table-layout: fixed;
width: 100%;
}
ol.tabs li {
position: relative;
display: table-cell;
overflow: hidden;
margin: 0;
padding: 0;
text-align: center;
text-transform: uppercase;
background-color: #ccc;
-moz-transition: background-color 0.3s linear;
-o-transition: background-color 0.3s linear;
-webkit-transition: background-color 0.3s linear;
transition: background-color 0.3s linear;
}
ol.tabs li:after {
content: " ";
display: block;
position: absolute;
top: 4px;
right: 6px;
width: 32px;
height: 32px;
border: 1px solid #4a4a4a;
border-bottom: none;
border-left: none;
border-radius: 2px;
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
}
ol.tabs li:last-child:after {
border: none;
}
ol.tabs li:last-child a:before {
border: none;
}
ol.tabs li.active a {
background-color: #fff;
-moz-transition: background-color 0.3s linear;
-o-transition: background-color 0.3s linear;
-webkit-transition: background-color 0.3s linear;
transition: background-color 0.3s linear;
}
ol.tabs li.active a:before {
content: " ";
display: block;
position: absolute;
top: 0px;
right: 0px;
width: 0px;
height: 0px;
border-style: solid;
border-width: 20px 0 20px 20px;
border-color: transparent transparent transparent #fff;
-moz-transform: rotate(360deg);
-ms-transform: rotate(360deg);
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
ol.tabs li.active a:after {
content: " ";
display: block;
position: absolute;
top: 0px;
left: 0px;
width: 0px;
height: 0px;
border-style: solid;
border-width: 20px 0 20px 20px;
border-color: transparent transparent transparent #ccc;
-moz-transform: rotate(360deg);
-ms-transform: rotate(360deg);
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
ol.tabs li:first-child a:after {
border: none;
}
ol.tabs li a {
display: block;
padding: 10px 0px;
margin-right: 20px;
color: #4a4a4a;
font-weight: bold;
text-decoration: underline;
}
ol.tabs li a.disabled {
cursor: initial;
font-weight: normal;
text-decoration: none;
}
ol.tabs li a.disabled:hover {
text-decoration: none;
}
<ol class="tabs">
<li class="step1 active">Step 1</li>
<li class="step2">Step 2</li>
<li class="step3">Step 3</li>
<li class="step4">Step 4</li>
</ol>
CSS
.breadcrumb {
list-style: none;
overflow: hidden;
font: 18px Helvetica, Arial, Sans-Serif;
}
.breadcrumb li {
float: left;
}
.breadcrumb li a {
color: white;
text-decoration: none;
padding: 10px 0 10px 55px;
background: brown; /* fallback color */
background: hsla(34,85%,35%,1);
position: relative;
display: block;
float: left;
}
.breadcrumb li a:after {
content: " ";
display: block;
width: 0;
height: 0;
border-top: 50px solid transparent; /* Go big on the size, and let overflow hide */
border-bottom: 50px solid transparent;
border-left: 30px solid hsla(34,85%,35%,1);
position: absolute;
top: 50%;
margin-top: -50px;
left: 100%;
z-index: 2;
}
.breadcrumb li a:before {
content: " ";
display: block;
width: 0;
height: 0;
border-top: 50px solid transparent; /* Go big on the size, and let overflow hide */
border-bottom: 50px solid transparent;
border-left: 30px solid white;
position: absolute;
top: 50%;
margin-top: -50px;
margin-left: 1px;
left: 100%;
z-index: 1;
}
.breadcrumb li:first-child a {
padding-left: 10px;
}
.breadcrumb li a:hover { background: hsla(34,85%,25%,1); }
.breadcrumb li a:hover:after { border-left-color: hsla(34,85%,25%,1) !important; }
<ul class="breadcrumb">
<li>Home</li>
<li>Vehicles</li>
<li>Vans</li>
<li>Camper Vans</li>
</ul>
change your css as mentioned in blow link
https://css-tricks.com/examples/TriangleBreadcrumbs/
How's this:
.tabs {
list-style: none;
padding: 0;
margin: 0;
}
.tabs a {
display: table-cell;
text-align: center;
vertical-align: middle;
color: #4a4a4a;
text-decoration: none;
text-transform: uppercase;
}
.tabs > li {
float: left;
position: relative;
border: 1px solid #7B7B7B;
border-right: none;
width: 140px;
height: 50px;
background: #cccccc;
cursor: pointer;
display: table;
}
.tabs > li:before {
position: absolute;
top: 50%;
right: 0;
margin: -15px -13px;
border-top: solid 1px #7B7B7B;
border-right: solid 1px #7B7B7B;
width: 25px;
/* .tabs > li height/2 */
height: 29px;
/* .tabs > li height/sqrt(3) */
transform: rotate(30deg) skewY(30deg);
/* create a rhombus */
-ms-transform: rotate(30deg) skewY(30deg);
/* IE 9 */
-webkit-transform: rotate(30deg) skewY(30deg);
/* Safari and Chrome */
background: #cccccc;
/* 49.1deg = atan(1.15) = atan(height/width) */
/* percentages are 100 - .tabs > li percentages*/
content: '';
z-index: 1;
}
.tabs > li:after {
position: absolute;
top: 0;
right: 0;
bottom: 0;
width: 40px;
background: #cccccc;
content: '';
z-index: 2;
}
.tabs > li.active,
.tabs > li.active:before,
.tabs > li.active:after {
background: #ffffff;
}
<ol class="tabs">
<li class="step1">Step 1</li>
<li class="step2 active">Step 2</li>
<li class="step3">Step 3</li>
<li class="step4">Step 4</li>
</ol>
Without borders and square end box for the end li:
.tabs {
list-style: none;
padding: 0;
margin: 0;
}
.tabs a {
display: table-cell;
text-align: center;
vertical-align: middle;
color: #4a4a4a;
text-decoration: none;
text-transform: uppercase;
}
.tabs > li {
float: left;
position: relative;
border-right: none;
width: 140px;
height: 50px;
background: #cccccc;
cursor: pointer;
display: table;
}
.tabs > li:before {
position: absolute;
top: 50%;
right: 0;
margin: -15px -13px;
border-top: solid 1px #7B7B7B;
border-right: solid 1px #7B7B7B;
width: 25px;
height: 29px;
transform: rotate(30deg) skewY(30deg);
-ms-transform: rotate(30deg) skewY(30deg);
-webkit-transform: rotate(30deg) skewY(30deg);
background: #cccccc;
content: '';
z-index: 1;
}
.tabs > li:after {
position: absolute;
top: 0;
right: 0;
bottom: 0;
width: 40px;
background: #cccccc;
content: '';
z-index: 2;
}
.tabs > li.active,
.tabs > li.active:before,
.tabs > li.active:after {
background: #ffffff;
}
.tabs > li:last-child:before,
.tabs > li:last-child:after {display:none; content:none;}
<ol class="tabs">
<li class="step1">Step 1</li>
<li class="step2 active">Step 2</li>
<li class="step3">Step 3</li>
<li class="step4">Step 4</li>
</ol>