currently when you hover over the drop down you will see the drop down links. in the drop down menu to the left of the links there is a gap. I would like that gap removed.
this is for my navigation bar drop down in desktop mode only.
this for my website JGittech.com.
it needs me to type more
all help would be appreciated
/*! CSS Used from: https://jgittech.com/stylesheets/nav.v5.css */
* {
box-sizing: border-box;
font-family: Arial,Helvetica,sans-serif
}
.menu-item-has-children .menu-li .nav-ul-li-a:hover,.sub-menu .menu-li .nav-ul-li-a:hover,.sub-menu .menu-li:hover {
background: #006084;
color: #fff
}
.navcontainer {
z-index: 999;
position: fixed;
top: 0;
left: 0;
margin: auto;
width: 100%
}
.active {
background: #009fd8;
color: #fff
}
.main-navigation {
background: #333
}
.nav-ul,body {
list-style-type: none;
padding: 0;
margin: 0
}
.fixednav,.menu {
display: flex
}
.menu {
flex-direction: column
}
.menu-li {
display: block;
list-style-type: none
}
.menu .nav-ul-li-a {
display: block;
text-align: center;
text-decoration: none;
color: #fff;
padding: 20px 1rem
}
.menu-li .nav-ul-li-a:hover,a:hover {
color: #fff
}
.nav-ul-ul {
display: none
}
.nav-ul .menu-li:hover>ul {
max-width: 100%;
display: block;
color: #fff
}
.fixednav {
flex-direction: row;
z-index: 9999;
width: 100%;
height: 60px
}
.leftnav {
line-height: 20px
}
#media (min-width:800px) {
.menu {
display: flex;
flex-direction: row;
justify-content: flex-start
}
.nav-ul .menu-li:hover>ul {
background: #333
}
.nav-ul .menu-li:hover>.nav-ul-li-a,.sub-menu .menu-li .nav-ul-li-a:hover,.sub-menu .menu-li:hover {
background: #006084;
color: #fff
}
.sub-menu .menu-li {
display: flex;
padding-right: 1em
}
.nav-ul-ul {
position: absolute
}
.nav-ul-ul,input[data-function*=swipe],label[data-function*=swipe] {
display: none
}
}
#media (max-width:799px) {
.nav-ul .menu-li:hover>ul {
background: #263249
}
.nav-ul .menu-li:hover>.nav-ul-li-a {
color: #fff
}
.menu-item-has-children .menu-li .nav-ul-li-a:hover,.sub-menu .menu-li .nav-ul-li-a:hover,.sub-menu .menu-li:hover {
background: #006084;
color: #fff
}
.fixednav,.nav-ul-ul {
display: block
}
label[data-function*=swipe] {
display: block;
position: absolute;
top: 30px;
left: 30px;
z-index: 1;
width: 42px;
height: 42px;
font: 42px fontawesome;
text-align: center;
color: #333;
cursor: pointer;
transform: translate3d(0,0,0);
transition: transform .3s
}
.fixednav {
text-align: left
}
.menu .nav-ul-li-a {
display: block;
text-decoration: none;
padding: 0 20px;
color: #fff;
border: 3px solid #fff;
text-align: center;
font-size: 18px;
font-weight: 900;
padding: 20px 1rem;
margin: 0 20px
}
.nav1contain {
display: flex;
height: 60px
}
input[data-function*=swipe] {
position: absolute;
opacity: 0
}
label[data-function*=swipe]:hover {
color: #263249
}
input[data-function*=swipe]:checked~label[data-function*=swipe] {
transform: translate3d(280px,0,0)
}
label[data-function*=swipe]:checked {
display: block
}
label:nth-child(2) {
display: none
}
input[data-function*=swipe]:checked~label:nth-child(2) {
display: block;
transform: translate3d(280px,0,0)
}
input[data-function*=swipe]:checked~label:nth-child(3) {
display: none
}
input[data-function*=swipe]:checked~.sidebar {
transform: translate3d(0,0,0)
}
input[data-function*=swipe]:checked~.sidebar .menu-li {
width: 100%
}
.sidebar {
transform: translate3d(-280px,0,0);
position: absolute;
width: 280px;
background: #263249;
color: #eee;
left: 0;
transition: all .3s
}
.menu-li {
display: inline-block;
padding: 10px;
list-style: none;
background: #263249;
list-style-type: none
}
.menu-item-has-children:hover {
display: block
}
}
.button {
display: block;
width: calc(100% - 30px);
height: 40px;
margin: 2% 15px;
background-color: #009fd8;
box-shadow: 0 6px 9px rgba(50,50,93,.06),0 2px 5px rgba(0,0,0,.08),inset 0 1px 0 #ffb9f6;
border-radius: 4px;
color: #fff;
font-weight: 600;
cursor: pointer
}
.active2 {
background: #00569b;
color: #fff
}
<div class="nav1contain">
<input data-function="swipe" id="swipe" type="checkbox">
<label data-function="swipe" for="swipe"></label>
<label data-function="swipe" for="swipe"></label>
<div class="navcontainer sidebar">
<nav class="main-navigation fixednav menu">
<ul class="menu nav-ul">
<li class = "menu-li"><a class = " active leftnav nav-ul-li-a" href="../index.html">Home</a></li>
<li class = "menu-li"> <a class = "nav-ul-li-a " href="pages/about.html">About</a> </li>
<li class = "menu-li"> <a class = "nav-ul-li-a" href="pages/products.html">Products</a> </li>
<li class = "menu-li"> <a class = "nav-ul-li-a" href="pages/contact.html">Contact</a> </li>
<li class = "menu-li"> <a class = "nav-ul-li-a" href="https://statuspage.freshping.io/13300-JGittechLLCStatusPage/check/91333">Status</a> </li>
<li class = "menu-li"> <a class = "nav-ul-li-a" href="../sitemap.html">Sitemap</a> </li>
<li class = "menu-li"> <a class = "nav-ul-li-a" href="pages/video.html">Videos</a> </li>
<li class="menu-item-has-children menu-li"> <a class ="nav-ul-li-a" href="#">Legal +</a>
<ul class="nav-ul-ul">
<li class = "menu-li"> <a class = "nav-ul-li-a" href="pages/legal/terms.pdf">Terms of Use</a> </li>
<li class = "menu-li"> <a class = "nav-ul-li-a" href="pages/legal/privacy.pdf">Privacy Policy</a> </li>
<li class = "menu-li"> <a class = "nav-ul-li-a" href="pages/legal/disclaimer.pdf">Disclaimer Policy</a> </li>
<li class = "menu-li"><a class = "nav-ul-li-a" href="pages/legal/cookie.html">Cookie Policy</a> </li>
<li class = "menu-li"> <a class = "nav-ul-li-a" href="pages/legal/return.pdf">Return Policy</a> </li>
</ul>
</li>
</ul>
</nav>
</div>
</div>
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.css" rel="stylesheet">
.
.nav-ul-ul { padding:0; } should do the trick.
Related
<body>
<header class="main-header">
<div class="container">
<img src="images/logo.svg" alt="Manage">
<button class="toggle-button">
<span class="toggle-button__bar"></span>
<span class="toggle-button__bar"></span>
<span class="toggle-button__bar"></span>
</button>
<nav class="main-nav">
<ul role="list" class="main-nav__list">
<li class="main-nav__list--item">Pricing</li>
<li class="main-nav__list--item">Product</li>
<li class="main-nav__list--item">About Us</li>
<li class="main-nav__list--item">Careers</li>
<li class="main-nav__list--item">Community</li>
</ul>
</nav>
<button class="button button-header">Get Started</button>
</div>
</header>
<script type="module" src="/script/script.js"></script>
/* CSS/SASS code
I do not know why my logo/image is being placed in the middle of the header, instead of
the top left corner of the header. I do not know how to fix this.
If anybody has some nice suggestions, feel free to tell */
#mixin display-flex() {
display: -webkit-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
align-items: center;
}
#mixin media-min-width($width) {
#media (min-width: $width) {
#content;
}
}
.main-header {
position: relative;
padding: $pad-header 0;
.container {
#include display-flex();
justify-content: space-around;
a {
display: inline-block;
text-decoration: none;
font-size: $fs-nav;
font-weight: $fw-semi-bold;
}
.main-nav {
display: none;
#include media-min-width(50rem) {
display: block;
}
}
.button {
color: hsl(0deg, 0%, 98%);
font-weight: 700;
background: hsl(12deg, 88%, 59%);
padding: 0.7rem 1rem;
border: 0;
border-radius: 100vmax;
&:hover {
cursor: pointer;
}
:focus {
outline: none;
}
}
.button-header {
display: none;
#include media-min-width(50rem) {
display: block;
}
}
.toggle-button {
position: absolute;
top: 50%;
right: 2%;
transform: translateY(-50%);
background: transparent;
border: 0;
cursor: pointer;
#include media-min-width(50rem) {
display: none;
}
.toggle-button__bar {
display: block;
background: $clr-secondary;
width: 2rem;
height: 0.3rem;
margin: 0.3rem 0;
&:last-of-type {
margin: 0;
}
}
}
}
}
.main-nav__list {
#include display-flex();
justify-content: center;
gap: clamp(1.7rem, 1.9rem, 2.5rem);
.main-nav__list--item a {
cursor: pointer;
}
}
I have to create button animation like below:
https://media.giphy.com/media/YLgJHbH1u916XSo3JD/giphy.gif
I did it with "transition" but now can't implement that solution to my website.
my button animation solution: http://jsfiddle.net/guhqcxzt/
My website part where I wanna implement it on 'li' tags. (html and scss)
<nav class="left-side">
<ul class="navigations">
<li>ABOUT US</li>
<li>HOTEL</li>
<li>CONTACT US</li>
</ul>
<div class="rights">© 2021 All rights reserved.</div>
</nav>
nav,
.left-side {
#include flex(space-between, center, column);
min-height: 90vh;
background: $color-grey-dark-1;
padding: 5rem 0 3rem 0;
width: 18%;
color: $color-grey-light-1;
}
.navigations {
width: 100%;
li {
list-style: none;
a {
text-decoration: none;
color: $color-grey-light-1;
display: block;
padding: 2rem 0;
margin: 0.5rem 0;
padding-left: 30%;
font-size: 2.5rem;
}
}
}
a:hover {
background: $color-primary-light;
}
try this :
add transition in <a> tag
navigations {
width: 100%;
li {
list-style: none;
a {
text-decoration: none;
color: $color-grey-light-1;
display: block;
padding: 2rem 0;
margin: 0.5rem 0;
padding-left: 30%;
font-size: 2.5rem;
transition:0.5s;
}
}
}
a:hover {
background: $color-primary-light;
}
do you want this one?
try this code :
nav,.left-side
{
display: flex;
justify-content: space-between;
align-items: center;
flex-direction: column;
min-height: 90vh;
background: black;
padding: 4rem 0 3rem 0;
width:300px;
color: grey;
}
.navigations
{
width: 100%;
}
li
{
position:relative;
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: center;
width: 100%;
height: 100px;
}
li::before
{
content:'';
position:absolute;
width:0%;
height:70px;
background:red;
left:-20px;
transition:0.5s;
}
li:hover::before
{
width:100%;
}
a
{
position:relative;
color: grey;
margin: 0.5rem 0;
width:92.4%;
text-decoration:none;
}
.rights {
font-size: 1.5rem;
}
<nav class="left-side">
<ul class="navigations">
<li >ABOUT US</li>
<li> HOTE </li>
<li>CONTACT US</li>
</ul>
<div class="rights">© 2021 All rights reserved.</div>
</nav>
I'm trying to make a pure CSS mobile menu, and I'm having trouble formatting the checkbox label.
I want the checkbox label to turn yellow AND the mobile menu to appear, but I can only get the menu.
I know the input tag only affects adjacent elements, but I've seen this working elsewhere.
Please help!
Here is my jsfiddle:
https://jsfiddle.net/ichormosquito/wqzj36nh/15/
<input id="menu-btn" type="checkbox" />
<label for="menu-btn" class="overlord">
<span id="hamburger" class="hamb" /></label>
<ul id="mobmen">
<li>HOME</li>
<li>ABOUT</li>
<li>CONTACT</li>
<li>SHOP</li>
<li>BLOG</li>
</ul>
#menu-btn { visibility: hidden; position: absolute; }
#hamburger { background-color: blue;
float: right; margin-right: 10px; cursor: pointer; background-size: 60px; width: 60px; height: 60px;
}
#menu-btn:checked + #hamburger {background-color: yellow;}
#mobmen {
display: none;
}
#menu-btn:checked ~ #mobmen {
display: block;
}
#menu-btn:focus { outline: 0; }
.mobilemenu a { color: #ffffff;}
ul#mobmen {
text-align: center;
clear: both;
line-height: 100px;
font-family: 'brandon-grotesque';
font-weight: 500;
color: #ffffff;
font-size: x-large; }
ul#mobmen li {
border-top: solid 2px #220000;
background-color: #440000;
}
ul#mobmen li:hover {
background-color: #660000;
}
ul#mobmen li:focus {
background-color: #660000;
}
You have t get deeper and target the span within the label
#menu-btn:checked + label #hamburger {...}
#menu-btn {
visibility: hidden;
position: absolute;
}
#hamburger {
background-color: blue;
float: right;
margin-right: 10px;
cursor: pointer;
background-size: 60px;
width: 60px;
height: 60px;
}
#menu-btn:checked+#hamburger {
background-color: yellow;
}
#mobmen {
display: none;
}
#menu-btn:checked+label #hamburger {
background-color: yellow;
}
#menu-btn:checked~#mobmen {
display: block;
}
#menu-btn:focus {
outline: 0;
}
.mobilemenu a {
color: #ffffff;
}
ul#mobmen {
text-align: center;
clear: both;
line-height: 100px;
font-family: 'brandon-grotesque';
font-weight: 500;
color: #ffffff;
font-size: x-large;
}
ul#mobmen li {
border-top: solid 2px #220000;
background-color: #440000;
}
ul#mobmen li:hover {
background-color: #660000;
}
ul#mobmen li:focus {
background-color: #660000;
}
<input id="menu-btn" type="checkbox" />
<label for="menu-btn" class="overlord">
<span id="hamburger" class="hamb" />
</label>
<ul id="mobmen">
<li>HOME</li>
<li>ABOUT</li>
<li>CONTACT</li>
<li>SHOP</li>
<li>BLOG</li>
</ul>
I have styling problem where my avatar image height will affect other inline items next to it. The image below is to illustrate the problem.
So if you see when I make my avatar logo taller it'll bring down the navigation links.
I want my avatar image not to affect the links next to it.
Here's my css and html:
.terms-link {
display: inline-flex;
align-items: center;
margin-right: -9px;
}
.user {
width: 153px;
}
.terms {
width: 103px;
}
.dropdown {
position: absolute;
right: 0;
padding: 30px 50px 30px 0;
background-color: #336F9C;
margin-top: 17px;
z-index: 10;
}
.right-side {
display: flex;
align-items: center;
}
.sign-up {
display: inline;
color: white;
margin-left: 1rem;
margin-right: 1rem;
}
.sign-up a {
padding: 5px;
}
nav a.is-active {
border-bottom: 3px solid #00aedb;
}
nav a.is-active.transparent {
border-bottom: 0;
color: #00aedb !important;
}
nav {
margin-bottom: 0;
}
nav a {
padding: 0 1.5rem 17px 1.5rem;
position: relative;
color: white;
text-decoration: none;
font-size: medium;
}
.explore-beta span {
font-size: x-small;
font-style: italic;
}
.spacer {
display: inline;
font-size: medium;
padding: 0 1rem 17px 1rem;
color: white;
}
.avatar-frame{border: 1.5px solid #c7b89e;}
.avatar-frame,.avatar-frame img{
width:30px;
height: 30px;
-webkit-border-radius: 50%; /* Saf3+, Chrome */
border-radius: 50%; /* Opera 10.5, IE 9 */
/*-moz-border-radius: 50%; Disabled for FF1+ */
}
<div class="right-side">
<nav>
<a routerLink="/initiatives" routerLinkActive="is-active">Initiatives</a>
<a routerLink="/search" routerLinkActive="is-active">Summary</a>
<a routerLink="/clinical" routerLinkActive="is-active">Clinical Filtering</a>
<a routerLink="/explore" routerLinkActive="is-active">Explore</a>
<a routerLink="/beacon" routerLinkActive="is-active">Beacon</a>
<a routerLink="/about" routerLinkActive="is-active">About</a>
<a *ngIf="!auth.authenticated()" class="sign-up">
<a (click)="auth.login()">Log in</a>
<div class="spacer">|</div>
<a (click)="openSignUpDialog()">Sign up</a>
</a>
<a *ngIf="auth.authenticated()" [ngClass]="{'is-active': termsLinkActive}" (click)="toggleUser($event)" class="avatar-link">
<span class="terms-link">
<div class="avatar-frame">
<img [src]="userPicture" />
</div>
</span>
<div *ngIf="userDropdown" [ngClass]="['user', 'dropdown']" (click)="auth.logout()">
<a>Log out</a>
</div>
</a>
</nav>
</div>
You can use position:absolute on your avatar-link class to remove it out of the default document flow and set its parent i.e. nav to position:relative;
This will ensure avatars dimensions do not effect its siblings.
div{
border: 1px solid black;
}
nav {
position: relative;
}
.avatar-link {
position: absolute;
border: 1px solid red;
right: 20px;
top: 50%;
transform: translateY(-50%);
}
.terms-link {
display: inline-flex;
align-items: center;
margin-right: -9px;
}
.user {
width: 153px;
}
.terms {
width: 103px;
}
.dropdown {
position: absolute;
right: 0;
padding: 30px 50px 30px 0;
background-color: #336F9C;
margin-top: 17px;
z-index: 10;
}
.right-side {
display: flex;
align-items: center;
}
.sign-up {
display: inline;
color: white;
margin-left: 1rem;
margin-right: 1rem;
}
.sign-up a {
padding: 5px;
}
nav a.is-active {
border-bottom: 3px solid #00aedb;
}
nav a.is-active.transparent {
border-bottom: 0;
color: #00aedb !important;
}
nav {
margin-bottom: 0;
}
nav a {
padding: 0 1.5rem 17px 1.5rem;
position: relative;
color: white;
text-decoration: none;
font-size: medium;
}
.explore-beta span {
font-size: x-small;
font-style: italic;
}
.spacer {
display: inline;
font-size: medium;
padding: 0 1rem 17px 1rem;
color: white;
}
.avatar-frame {
border: 1.5px solid #c7b89e;
}
.avatar-frame,
.avatar-frame img {
width: 30px;
height: 30px;
-webkit-border-radius: 50%;
/* Saf3+, Chrome */
border-radius: 50%;
/* Opera 10.5, IE 9 */
/*-moz-border-radius: 50%; Disabled for FF1+ */
}
<div class="right-side">
<nav>
<a routerLink="/initiatives" routerLinkActive="is-active">Initiatives</a>
<a routerLink="/search" routerLinkActive="is-active">Summary</a>
<a routerLink="/clinical" routerLinkActive="is-active">Clinical Filtering</a>
<a routerLink="/explore" routerLinkActive="is-active">Explore</a>
<a routerLink="/beacon" routerLinkActive="is-active">Beacon</a>
<a routerLink="/about" routerLinkActive="is-active">About</a>
<a *ngIf="!auth.authenticated()" class="sign-up">
<a (click)="auth.login()">Log in</a>
<div class="spacer">|</div>
<a (click)="openSignUpDialog()">Sign up</a>
</a>
<a *ngIf="auth.authenticated()" [ngClass]="{'is-active': termsLinkActive}" (click)="toggleUser($event)" class="avatar-link">
<span class="terms-link">
<div class="avatar-frame">
<img [src]="userPicture" />
</div>
</span>
<div *ngIf="userDropdown" [ngClass]="['user', 'dropdown']" (click)="auth.logout()">
<a>Log out</a>
</div>
</a>
</nav>
</div>
I'm having a weird issue with my Shopify dropdown menu.
On mobile sites or when i shrink a window the linklists for women and men overlay each other. please see picture, any clue on how to fix this?
My store is triplepeace.myshopify.com pss:muitwe
.mobile-mega-nav {
display: none;
#include breakpoint(m) {
display: block;
}
}
.navigation.mobile {
position: absolute;
top: 0;
bottom: 0;
background: #043342 none repeat scroll 0% 0%;
z-index: 3000;
max-width: 450px;
width: 100%;
overflow: hidden;
#include transform(translateX(-450px));
#include transition(all 0.2s $ease-out-quad);
#include breakpoint(xs) {
#include transform(translateX(-300px));
max-width: 300px;
}
&.visible {
#include breakpoint(m) {
#include transform(translateX(0px));
}
}
.branding {
position: relative;
font-size: 0;
img { height: auto; }
}
.mobile-nav-logo {
display: inline-block;
max-width: 200px;
}
.sticky-logo { display: none; }
.logo-regular {
display: block;
}
.has-retina {
#include retina {
.logo-regular {
display: none;
}
.logo-retina {
display: block;
}
}
}
ul {
position: relative;
padding: 0 25px;
#include transition(all 0.2s $ease-out-quad);
&.out-of-view {
#include transform(translateX(-100%));
}
}
ul ul {
position: absolute;
top: 0;
left: 100%;
width: 100%;
&.in-view {
display: block;
}
}
.enter-linklist {
#extend %icon;
display: inline-block;
float: right;
margin-top: -4px;
border: 1px solid #fff;
border-radius: 0;
padding: 10px 12px;
color: #fff;
}
.back {
position: relative;
display: none;
padding: 28px 20px;
border-bottom: 1px solid $border-color;
cursor: pointer;
font-family: $navigation-font;
font-weight: $navigation-weight;
color: #fff;
text-transform: uppercase;
{% if settings.navigation-font-small-caps %}
#extend %small-caps;
{% endif %}
#include breakpoint(m) {
display: block;
}
.icon {
#extend %icon;
position: absolute;
top: 50%;
left: 0;
padding: 0;
border: 0;
#include transform(translateY(-50%));
}
}
.first a {
// border-top: 1px solid $border-color;
}
a {
display: block;
padding: 28px 20px;
#include breakpoint(m){ text-transform:uppercase; }
#include breakpoint(s){ text-transform:uppercase; }
#include breakpoint(xs){ text-transform:uppercase; }
}
.cart-count {
display: none;
}
.mobile-link {
display: block;
text-transform:uppercase;
}
.navigation-toggle { padding-top: 0; }
.search-form {
position: relative;
padding: 20px;
margin: 0;
input[type="submit"] {
right: 20px;
}
}
.search-input {
max-width: 100%;
width: 100%;
}
}
<!-- Menu links -->
<li class="has-mega-nav first" data-mega-nav="true">
<a data-linklist-trigger="shop" href="/collections/all">Shop <span class="enter-linklist"></span></a>
<ul class="mobile-mega-nav" data-linklist="shop">
<li>
<span class="back"><span class="icon"></span> Back to previous</span>
</li>
<li class="has-dropdown">
<a data-linklist-trigger="apparel" href="">MEN<span class="enter-linklist"></span></a>
<ul data-linklist="apparel">
<li>
<span class="back"><span class="icon"></span> Back to previous</span>
</li>
<li>Shirts</li>
<li>Color changing tees</li>
<li>Hoodies</li>
<!-- <li>Shop Our Instagram</li> -->
<li>Shop By Design</li>
<!--<li data-image-src="" data-image-alt="">New Arrivals</li>-->
<li>Shop All</li>
</ul>
</li>
<li class="has-dropdown">
<a data-linklist-trigger="apparel" href="">WOMEN<span class="enter-linklist"></span></a>
<ul data-linklist="apparel">
<li>
<span class="back"><span class="icon"></span> Back to previous</span>
</li>
<li>boyfriend Tee</li>
<li>V-neck</li>
<li>Scoop neck</li>
<!-- <li>Shop Our Instagram</li> -->
<li>Tank tops</li>
<li>Hoodies</li>
<!--<li data-image-src="" data-image-alt="">New Arrivals</li>-->
<li>Shop All</li>
</ul>
</li>
Try adding this in your CSS styles
.in-view .active {
background: rgb(4, 51, 66);
}