Actually, I will want to align the titles on the left.
I know the problem may be this line, but I don't know what properties I should use to fix my problem? :-S
.sidebar .nav-links li a {
display: flex;
justify-content: space-between;
text-decoration: none;
transition: all 0.4s ease;
border-bottom: 1px solid #ccc;
padding: 13px 0;
}
On the other hand, the icons are correctly positioned.
CSS
.sidebar .nav-links {
margin-top: 10px;
}
.sidebar .nav-links li {
position: relative;
list-style: none;
}
.sidebar .nav-links li a {
display: flex;
justify-content: space-between;
text-decoration: none;
transition: all 0.4s ease;
border-bottom: 1px solid #ccc;
padding: 13px 0;
}
.sidebar .nav-links li a.active {
background: #081D45;
}
.sidebar .nav-links li a:hover {
background: #081D45;
}
.sidebar .nav-links li i {
min-width: 60px;
text-align: center;
font-size: 18px;
color: #fff;
}
.sidebar .nav-links .item {
text-transform: uppercase;
}
.sidebar .nav-links li i.fa-chevron-down {
right: 1rem;
left: auto;
}
.sidebar .nav-links li.active i.fa-chevron-down {
transform: rotate(180deg);
}
.sidebar .nav-links li.active i {
color: white;
}
.sidebar .nav-links li a .links_name {
color: #fff;
font-size: 15px;
font-weight: 400;
white-space: nowrap;
}
HTML
<ul class="nav-links">
<li *ngFor="let menu of menus; let i = index" [class.active]="menu.active">
<ng-container>
<a class="item" (click)="selectMenu(menu)">
<i [class]="menu.iconClass"></i>
<span class="links_name">{{ menu.name }}</span>
<i class="fa fa-chevron-down"></i>
</a>
<ul
class="submenu"
#submenu
[ngStyle]="{ 'height': menu.active ? submenu.scrollHeight + 'px' : 0 + 'px' } "
>
<li *ngFor="let submenu of menu.submenu">
<a routerLink="{{ submenu.url }} "
><span class="links_subname">{{ submenu.name }}</span>
</a>
</li>
</ul>
</ng-container>
</li>
</ul>
Here is a reproduction => Stackblitz.
Thank you in advance for your time.
you can try this.
.sidebar .nav-links li a {
display: flex;
justify-content: start;
text-decoration: none;
transition: all 0.4s ease;
border-bottom: 1px solid #ccc;
padding: 13px 0;
}
.sidebar .nav-links li i.fa-chevron-down {
right: 0;
position: absolute;
}
.sidebar .nav-links li a {
display: flex;
justify-content: start;
text-decoration: none;
transition: all 0.4s ease;
border-bottom: 1px solid #ccc;
padding: 13px 0;
}
a.item i.fa-chevron-down {
position: absolute;
min-width: 30px;
right: 4px;
}
Related
I would like to have the same result as this example.
For the sub-menus (portfolio, contact, etc...): a background that takes the whole width.
The titles of the submenus are almost centered
In my sidebar, I have two rubrics: Category and Markets.
Here is my example...
My problem is that the width of the submenus (Portfolio, Contact, Indice, etc..) are not wide.
There is white to the left.
I would also like to center the menu subtitles like the example I showed you.
I made an illustration of the menu here -> Stackblitz
Thank you a lot for your help and your time.
HTML
<div class="sidebar" [class.sidebar-close]="!openSidebar" >
<div class="logo-details">
<img src="https://zupimages.net/up/22/42/refj.png" />
</div>
<ul class="nav-links" id="nav-links" >
<li *ngFor="let item of menuSidebar" #itemEl routerLinkActive="active">
<div *ngIf="item.sub_menu.length == 0" class="dropdown-title">
<a [routerLink]="[item.link]">
<i [class]="item.icon"></i>
<span class="link_name">{{item.link_name}}</span>
</a>
</div>
<div *ngIf="item.sub_menu.length > 0" class="dropdown-title" (click)="showSubmenu(itemEl)">
<a>
<i [class]="item.icon"></i>
<span class="link_name">{{item.link_name}}</span>
</a>
<i class='bx bxs-chevron-down arrow'></i>
</div>
<ul class="sub-menu" [class.blank]="item.sub_menu.length == 0">
<li><a class="link_name">{{item.link_name}}</a></li>
<li *ngFor="let item_sub of item.sub_menu" routerLinkActive="active">
<a [routerLink]="[item_sub.link]">{{item_sub.link_name}}</a>
</li>
</ul>
</li>
</ul>
</div>
CSS
/* Sidebar */
.sidebar {
position: fixed;
top: 0;
left: 0;
height: 100%;
width: 260px;
background: white;
z-index: 100;
transition: all 0.5s ease;
}
.sidebar.sidebar-close {
width: 60px;
}
.sidebar .logo-details{
width: 100%;
padding: 10px 10px 10px 10px;
}
.sidebar .logo-details img{
height: 50px;
width: 80%;
display: block;
margin: 0 auto;
}
.sidebar.sidebar-close .logo-details img {
width: 37px;
height: 50px;
transform: scale(1.2) translateX(-3px);
}
.sidebar .nav-links {
height: 100%;
width: 260px;
padding-bottom: 150px;
overflow: auto;
}
.sidebar .nav-links::-webkit-scrollbar {
display: none;
}
.sidebar .nav-links li {
list-style: none;
}
.sidebar .nav-links > li {
position: relative;
width: fit-content;
}
.sidebar .nav-links li:hover {
background: #ffa726;
}
.sidebar .nav-links li.active {
background-image: linear-gradient(to right, #ffa726, #ff5722);
}
/* Dropdown Title */
.sidebar .nav-links .dropdown-title {
width: 260px;
overflow: hidden;
transition: all 0.52s ease;
/* */
display: flex;
align-items: center;
justify-content: space-between;
position: relative;
}
.sidebar.sidebar-close .nav-links .dropdown-title {
width: 60px;
}
.sidebar .nav-links li i {
height: 50px;
min-width: 60px;
text-align: center;
line-height: 50px;
color: #ffa726;
font-size: 20px;
cursor: pointer;
transition: all 0.3s ease;
}
.sidebar .nav-links li:hover i,
.sidebar .nav-links li.active i {
color: white;
}
.sidebar .nav-links li.showMenu i.arrow {
transform: rotate(-180deg);
}
/* a Tag */
.sidebar .nav-links li a {
display: flex;
align-items: center;
text-decoration: none;
width: 100%;
}
/* Link Name */
.sidebar .nav-links li a .link_name {
font-size: 16px;
font-weight: 600;
color: #ffa726;
transition: all 0.4s ease;
}
.sidebar .nav-links li:hover a .link_name,
.sidebar .nav-links li.active a .link_name {
color: white;
}
.sidebar.sidebar-close .nav-links li a .link_name {
pointer-events: none;
}
/* Sub Menu */
.sidebar .nav-links li .sub-menu {
padding: 6px 6px 14px 70px;
/* margin-top: -10px; */
background: white;
display: none;
transition: all 0.4s ease;
}
.sidebar .nav-links li.showMenu .sub-menu {
display: block;
}
.sidebar .nav-links li .sub-menu a {
color: #ffa726;
font-size: 15px;
padding: 7px 0;
white-space: nowrap;
transition: all 0.3s ease;
}
.sidebar .nav-links li .sub-menu li {
padding-left: 10px;
}
.sidebar .nav-links li .sub-menu li:hover a,
.sidebar .nav-links li .sub-menu li.active a {
color: white;
}
.sidebar.sidebar-close .nav-links li .sub-menu {
position: absolute;
left: 100%;
top: -10px;
margin-top: 0;
padding: 0;
border-radius: 0 6px 6px 0;
opacity: 0;
display: block;
pointer-events: none;
transition: 0s;
overflow: hidden;
}
.sidebar.sidebar-close .nav-links li .sub-menu li {
padding: 6px 15px;
width: 200px;
}
.sidebar.sidebar-close .nav-links li:hover .sub-menu {
top: 0;
opacity: 1;
pointer-events: auto;
transition: all 0.4s ease;
}
.sidebar .nav-links li .sub-menu .link_name {
display: none;
}
.sidebar.sidebar-close .nav-links li .sub-menu .link_name {
font-size: 16px;
font-weight: 600;
/* opacity: 1; */
display: block;
}
/* li:first-child contain .link_name */
.sidebar.sidebar-close .nav-links li .sub-menu li:first-child {
background: white;
pointer-events: none;
}
.sidebar.sidebar-close .nav-links li .sub-menu li:first-child:hover .link_name,
.sidebar.sidebar-close .nav-links li .sub-menu li:first-child.active .link_name {
color: #ffa726;
}
.sidebar .nav-links li .sub-menu.blank {
pointer-events: auto;
/* padding: 3px 20px 6px 16px; */
opacity: 0;
pointer-events: none;
}
.sidebar .nav-links li:hover .sub-menu.blank,
.sidebar .nav-links li.active .sub-menu.blank {
top: 50%;
transform: translateY(-50%);
}
.sidebar.sidebar-close ~ .home-section {
left: 60px;
width: calc(100% - 60px);
}
Your ul.sub_menu tag has a padding of 70px on the left.
At the moment you have this CSS affecting it:
.sidebar .nav-links li .sub-menu {
padding: 6px 6px 14px 70px;
background: white;
display: none;
transition: all 0.4s ease;
}
If you just add a different higher priority CSS declaration that tells it to have a different padding on the sub menu, it should work.
Here is what it looks like with a 15px padding on the left:
Also, I do see a CSS declaration that tells all ul tags to have a padding of 0. However, this is a lower priority than the mentioned code and gets overruled.
You have a 70px left padding value in the element .sidebar .nav-links li .sub-menu, which is your <ul> element. This is being generated by this shorthand line of code for the padding values:
padding: 6px 6px 14px 70px;
You need to remove this 70px value and then just tweak the padding-left value of .sidebar .nav-links li .sub-menu li which is currently set to 10px;
In my sidebar, when I hover over a submenu (portfolio or contact)
I would like the red background to take up the entire background of the cell.
Do you know how I could create this?
I think the problem is here? But I don't see what priority I should add?
.sidebar .nav-links li:hover {
background: red;
}
Thanks a lot
Here is a demonstration via Stackblitz
HTML
<ul class="nav-links" id="nav-links" >
<li *ngFor="let item of menuSidebar" #itemEl >
<div *ngIf="item.sub_menu.length > 0" class="dropdown-title" (click)="showSubmenu(itemEl)">
<a>
<i [class]="item.icon"></i>
<span class="link_name">{{item.link_name}}</span>
</a>
<i class='bx bxs-chevron-down arrow'></i>
</div>
<ul class="sub-menu" [class.blank]="item.sub_menu.length == 0">
<li><a class="link_name">{{item.link_name}}</a></li>
<li *ngFor="let item_sub of item.sub_menu" routerLinkActive="active">
<a [routerLink]="[item_sub.link]">{{item_sub.link_name}}</a>
</li>
</ul>
</li>
</ul>
CSS
/* Sidebar */
.sidebar {
position: fixed;
top: 0;
left: 0;
height: 100%;
width: 260px;
background: white;
z-index: 100;
transition: all 0.5s ease;
}
.sidebar.sidebar-close {
width: 60px;
}
.sidebar .logo-details{
width: 100%;
padding: 10px 10px 10px 10px;
}
.sidebar .logo-details img{
height: 50px;
width: 80%;
display: block;
margin: 0 auto;
}
.sidebar.sidebar-close .logo-details img {
width: 37px;
height: 50px;
transform: scale(1.2) translateX(-3px);
}
.sidebar .nav-links {
height: 100%;
width: 260px;
padding-bottom: 150px;
overflow: auto;
}
.sidebar .nav-links::-webkit-scrollbar {
display: none;
}
.sidebar .nav-links li {
list-style: none;
}
.sidebar .nav-links > li {
position: relative;
width: fit-content;
}
.sidebar .nav-links li:hover {
background: red;
}
/* Dropdown Title */
.sidebar .nav-links .dropdown-title {
width: 260px;
overflow: hidden;
transition: all 0.52s ease;
display: flex;
align-items: center;
justify-content: space-between;
position: relative;
}
.sidebar.sidebar-close .nav-links .dropdown-title {
width: 60px;
}
.sidebar .nav-links li i {
height: 50px;
min-width: 60px;
text-align: center;
line-height: 50px;
color: #ffa726;
font-size: 20px;
cursor: pointer;
transition: all 0.3s ease;
}
.sidebar .nav-links li:hover i,
.sidebar .nav-links li.active i {
color: white;
}
.sidebar .nav-links li.showMenu i.arrow {
transform: rotate(-180deg);
}
/* a Tag */
.sidebar .nav-links li a {
display: flex;
align-items: center;
text-decoration: none;
width: 100%;
}
/* Link Name */
.sidebar .nav-links li a .link_name {
font-size: 16px;
font-weight: 600;
color: #ffa726;
transition: all 0.4s ease;
}
.sidebar .nav-links li:hover a .link_name,
.sidebar .nav-links li.active a .link_name {
color: white;
}
.sidebar.sidebar-close .nav-links li a .link_name {
pointer-events: none;
}
/* Sub Menu */
.sidebar .nav-links li .sub-menu {
padding: 6px 6px 14px 50px;
background: #239CD3;
display: none;
transition: all 0.4s ease;
}
.sidebar .nav-links li.showMenu .sub-menu {
display: block;
}
.sidebar .nav-links li .sub-menu a {
color: #ffa726;
font-size: 15px;
padding: 7px 0;
white-space: nowrap;
transition: all 0.3s ease;
}
.sidebar .nav-links li .sub-menu li {
padding-left: 10px;
}
.sidebar .nav-links li .sub-menu li:hover a,
.sidebar .nav-links li .sub-menu li.active a {
color: black;
}
.sidebar.sidebar-close .nav-links li .sub-menu {
position: absolute;
left: 100%;
top: -10px;
margin-top: 0;
padding: 0;
border-radius: 0 6px 6px 0;
opacity: 0;
display: block;
pointer-events: none;
transition: 0s;
overflow: hidden;
}
.sidebar.sidebar-close .nav-links li .sub-menu li {
padding: 6px 15px;
width: 200px;
}
.sidebar.sidebar-close .nav-links li:hover .sub-menu {
top: 0;
opacity: 1;
pointer-events: auto;
transition: all 0.4s ease;
}
.sidebar .nav-links li .sub-menu .link_name {
display: none;
}
.sidebar.sidebar-close .nav-links li .sub-menu .link_name {
font-size: 16px;
font-weight: 600;
display: block;
}
.sidebar.sidebar-close .nav-links li .sub-menu li:first-child {
background: white;
pointer-events: none;
}
.sidebar .nav-links li .sub-menu.blank {
pointer-events: auto;
opacity: 0;
pointer-events: none;
}
.sidebar .nav-links li:hover .sub-menu.blank,
.sidebar .nav-links li.active .sub-menu.blank {
top: 50%;
transform: translateY(-50%);
}
.sidebar.sidebar-close ~ .home-section {
left: 60px;
width: calc(100% - 60px);
}
Yes, the behaviour stems from the parent .sub-menu padding. You change background color of the child li element that is pushed away by the padding.
You can remove the padding from .sub-menu container and add it to your list items accordingly (if it's required by design):
.sidebar .nav-links li .sub-menu li:nth-child(2) {
padding: 6px 6px 0 50px;
}
.sidebar .nav-links li .sub-menu li:last-child {
padding: 0 6px 14px 50px;
}
It seems like you have a padding on your .sub-menu class. Removing it should solve your problem:
.sidebar .nav-links li .sub-menu {
background: #239CD3;
display: none;
transition: all 0.4s ease;
}
Check out the box model to better understand the behaviour of padding.
I'm creating an HTML/CSS menu for an Angular project.
I have two rubrics in the menu...
When I click on a rubric, there is a space that is created, how could I solve this problem, please?
The problem happens when hovering...
/* You can add global styles to this file, and also import other style files */
#import url('https://fonts.googleapis.com/css2?family=Open+Sans&display=swap');
* {
list-style: none;
text-decoration: none;
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Open Sans', sans-serif;
}
body {
background: #f5f6fa;
}
.wrapper .sidebar {
position: fixed;
top: 0;
left: 0;
height: 100%;
width: 225px;
background: rgb(5, 68, 104);
padding: 20px 0;
transition: all 0.5s ease;
}
.wrapper .sidebar ul li a {
display: block;
padding: 13px 60px;
border-bottom: 1px solid green;
color: rgb(241, 237, 237);
font-size: 16px;
position: relative;
background-color: red;
}
.wrapper .sidebar ul li a .icon {
color: #dee4ec;
width: 30px;
display: inline-block;
}
.wrapper .sidebar ul li a:hover {
color: #0c7db1;
border-right: 2px solid rgb(5, 68, 104);
}
.wrapper .sidebar li i {
position: absolute;
top: 1.2rem;
left: 1rem;
right: 1rem;
color: white;
transition: all 0.4s ease;
font-size: 18px;
}
.wrapper .sidebar li i.fa-chevron-down {
right: 1rem;
left: auto;
}
.wrapper .sidebar li.active i.fa-chevron-down {
transform: rotate(180deg);
}
.wrapper .sidebar li.active .menu {
color: white;
}
.wrapper .sidebar li.active i {
color: white;
}
<div class="wrapper">
<!-- Top Menu -->
<div class="sidebar">
<!-- Menu Item -->
<ul>
<li
*ngFor="let menu of menus; let i = index"
[class.active]="menu.active"
>
<ng-container>
<a class="item" (click)="selectMenu(menu)">
<i [class]="menu.iconClass"></i> {{ menu.name }}
<i class="fa fa-chevron-down"></i>
</a>
</ng-container>
</li>
</ul>
</div>
</div>
I share you a reproduction on stackblitz here.
Thank you in advance for your help and sharing.
.wrapper .sidebar ul li a:hover { color: #0c7db1; }
Just Remove the border tag From Hover and it will fix your Problem
As the comment suggests,
Seems like border-right on hover is the issue => .wrapper .sidebar ul li a:hover
#emre-ozgun
I have commented that line, see the answer snippet below
/* You can add global styles to this file, and also import other style files */
#import url('https://fonts.googleapis.com/css2?family=Open+Sans&display=swap');
* {
list-style: none;
text-decoration: none;
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Open Sans', sans-serif;
}
body {
background: #f5f6fa;
}
.wrapper .sidebar {
position: fixed;
top: 0;
left: 0;
height: 100%;
width: 225px;
background: rgb(5, 68, 104);
padding: 20px 0;
transition: all 0.5s ease;
}
.wrapper .sidebar ul li a {
display: block;
padding: 13px 60px;
border-bottom: 1px solid green;
color: rgb(241, 237, 237);
font-size: 16px;
position: relative;
background-color: red;
}
.wrapper .sidebar ul li a .icon {
color: #dee4ec;
width: 30px;
display: inline-block;
}
.wrapper .sidebar ul li a:hover {
color: #0c7db1;
/* border-right: 2px solid rgb(5, 68, 104);*/
}
.wrapper .sidebar li i {
position: absolute;
top: 1.2rem;
left: 1rem;
right: 1rem;
color: white;
transition: all 0.4s ease;
font-size: 18px;
}
.wrapper .sidebar li i.fa-chevron-down {
right: 1rem;
left: auto;
}
.wrapper .sidebar li.active i.fa-chevron-down {
transform: rotate(180deg);
}
.wrapper .sidebar li.active .menu {
color: white;
}
.wrapper .sidebar li.active i {
color: white;
}
<div class="wrapper">
<!-- Top Menu -->
<div class="sidebar">
<!-- Menu Item -->
<ul>
<li
*ngFor="let menu of menus; let i = index"
[class.active]="menu.active"
>
<ng-container>
<a class="item" (click)="selectMenu(menu)">
<i [class]="menu.iconClass"></i> {{ menu.name }}
<i class="fa fa-chevron-down"></i>
</a>
</ng-container>
</li>
</ul>
</div>
</div>
I don't understand why the border-bottom is not displayed entirely in the menu?
Here is my result below:
image
In this image, there is a space on the left that I would like to remove because it is not aesthetically pretty.
dashboard.component.html
<div class="sidebar" style="border-right: 1px solid black" [ngClass]="{ active: showSideBar }">
<div class="logo-details" style="border-bottom: 1px solid black;">
<span class="logo_name">
</span>
</div>
<ul id="accordion" class="accordion">
<li *ngFor="let menu of menus; let i = index" [class.active]="menu.active">
<ng-container>
<div class="menu" (click)="selectMenu(menu)">
<i [class]="menu.iconClass"></i> {{ menu.name }}
<i class="fa fa-chevron-down"></i>
</div>
</ng-container>
</li>
</ul>
style.css
#import url(https://fonts.googleapis.com/css?family=Open+Sans);
#import url(https://use.fontawesome.com/releases/v5.3.1/css/all.css);
*,
*:before,
*:after {
margin: 0;
padding: 0;
box-sizing: border-box;
}
h1 {
font-size: 58px;
}
h2 {
font-size: 30px;
}
ul {
list-style-type: none;
}
.sidebar {
position: fixed;
height: 100%;
width: 250px;
background: #239cd3;
/* overflow-y:scroll;*/
transition: all 0.5s ease;
}
/* LOGO */
.sidebar .logo-details {
height: 100px;
display: flex;
align-items: center;
}
/* ACCORDION */
.sidebar .accordion {
width: 100%;
margin: 0px;
border-radius: 4px;
}
/* MENU TITLE */
.sidebar .accordion .menu {
position: relative;
padding: 15px 15px 15px 20px;
color: white;
border-bottom: 1px solid #ccc;
cursor: pointer;
transition: all 0.4s ease;
font-size: 18px;
text-transform: uppercase;
text-decoration: none;
}
/* ICON MENU TITLE */
.sidebar .accordion li i {
position: absolute;
top: 1.2rem;
left: -15px;
/* left: 1rem; */
color: white;
transition: all 0.4s ease;
font-size: 18px;
}
.sidebar .accordion li i.fa-chevron-down {
right: 1rem;
left: auto;
}
.sidebar .accordion li.active i.fa-chevron-down {
transform: rotate(180deg);
}
The code is here for information -> Stackblitz.
Thank you in advance for your reply.
There is a padding-left: 2rem; for ul element. Remove that.
Give that padding-left: 2rem; to the li element in *ngFor.
remove border-bottom from div and add to li.
NOTE: THE NAVBAR IS NOT IN BOOTSTRAP
Okay, so, when I hover over my "More" button, it displays dropdown content but it just suddently appears and when I move my mouse somewhere else it suddently disappears. What I want, is to make the dropdown content appear through a transition or something like that. Here is my code:
<nav>
<ul>
<li>Home</li>
<li>Earn Coins</li>
<li>Get Rewards</li>
<li>Referrals</li>
<li>Vouchers</li>
<li><div class="dropdownd">
More
<i class="fa fa-caret-down"></i>
<div class="dropdown-contentd">
<a class="dropdowncontentn" href="leaderboard.php">Leaderboard</a>
<a class="dropdowncontentn" href="partnerships.php">Partnerships</a>
<a class="dropdowncontentn" href="contact.php">Contact us</a>
<a class="dropdowncontentn" href="socialmedia.php">Social Media</a>
<a class="dropdowncontentn" href="settings.php">Settings</a>
</div>
</div> </li>
<li>
<a href="#">
<i class="fa fa-bars"></i>
</a>
</li>
<li class="thum" style="float:right;margin-right:25px;">
<a onClick="navbar_coins_refresh.php" href="#" class="coinsnumber"><?php include 'navbar_coins.php'; ?></a>
</li>
</ul>
</nav>
# CSS #
* {
box-sizing:border-box;
-o-box-sizing:border-box;
-ms-box-sizing:border-box;
-moz-box-sizing:border-box;
-webkit-box-sizing:border-box;
}
nav ul li a {
color: #FFF;
text-decoration: none;
font-size: 16px;
-webkit-transition-duration: 0.4s;
transition-duration: 0.4s;
padding: 15px;
font-family: Ubuntu;
}
nav ul li a:hover {
text-decoration: none;
color: #444;
}
nav ul li a.coinsnumber:hover {
text-decoration: none;
color: white;
}
.dropdown-contentd {
display: none;
position: absolute;
top: 49px;
background-color: royalblue;
color: #FFF;
min-width: 160px;
box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);
z-index: 1;
/*border: 1px solid black;*/
margin: 0;
padding: 0;
padding-top: 10px;
padding-bottom: 10px;
transition: all .3s ease;
}
.dropdown-contentd a {
float: none;
color: black;
padding: 12px 16px;
color: #ffffff;
text-decoration: none;
display: block;
text-align: left;
transition: all .3s ease;
background-color: royalblue;
}
.dropdown-contentd a:hover {
color: #444;
}
.dropdownd:hover .dropdown-contentd {
display: block;
}
/* End General */
/* Start Navbar */
nav ul {
background-color: royalblue;
box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);
}
nav ul > li {
padding-left: 20px;
padding-right: 20px;
padding: 15px;
display: inline-block;
transition: all .3s ease;
margin-left: -5px
}
nav ul > ol {
position: absolute;
top: 49px;
right: 0;
background: #333;
text-align: center;
list-style: none;
display: none
}
nav ul > ol > li {
width: 100vw;
color: #FFF;
margin: 0;
padding: 0;
padding-top: 10px;
padding-bottom: 10px;
transition: all .3s ease;
}
nav ul > ol > li:hover a {
margin: 20px;
}
nav ul > ol > li:hover {
background: #000;
cursor: pointer
}
nav ul input {
opacity: .7;
padding: 5px;
float: right;
display: none
}
/* Start Menue Right */
/* Start Media Query */
#media screen and (max-width:950px){
nav ul > li:not(:first-child) {
display:none;
}
nav ul > li:nth-last-of-type(2) {
display: inline-block;
}
nav ul > li:last-of-type {
display: inline-block;
}
}
#media screen and (min-width:950px) {
nav ul > ol > li {
display:none
}
nav ul > li:nth-last-of-type(2) {
display: none
}
}
.dropdowncontentn {
background-color: royalblue;
}
nav {
z-index: 1;
position: fixed;
right: 0;
left: 0;
top: 0;
}````
It's common question. You have to use max-height transition, not just height. Check here How can I transition height: 0; to height: auto; using CSS?