I'm running into a problem in my website, where an horizontal scrollbar is always showing even when i add overflow-x: hidden to the body, html elements. Instead of hiding the scrollbar, another scrollbar is added vertically and now i have two vertical scrollbars!
This happened because i have a centered navigation and add to set a child div of that same navigation, to 100% of the viewport width. Checked the developer tools in chrome and that div is going some pixels to the right.
Anyway, since overflow didn't work, i tried to change the values of the calc() function to subtract those pixels but the horizontal scrollbar is still there.
Here is my code:
<div id="container">
<ul class="nav">
<li>home</li>
<li>
destinations
<div>
<div class="nav-column">
</div>
<div class="nav-column">
</div>
<div class="nav-column">
</div>
<div class="nav-column">
</div>
<div class="nav-column">
</div>
</div>
</li>
<li>about</li>
<li>contact</li>
</ul>
</div>
And the css:
body,html {
background-color: white;
border: 0;
outline: 0;
margin: 0;
padding: 0;
max-width: 100%;
overflow-x: hidden;
}
#container {
display: block;
margin: 0 auto;
text-align: center;
position: relative;
width: 100%;
}
.nav {
cursor: default;
display: inline-block;
height: 125px;
position: relative;
top: 50px;
width: auto;
-ms-flex-pack: center;
-ms-display: -ms-flexbox;
}
.nav,
.nav a,
.nav ul,
.nav li,
.nav div {
border: none;
padding: 0;
margin: 0;
outline: none;
}
.nav a {
text-decoration: none;
}
.nav li {
list-style: none;
}
.nav > li {
display: block;
float: left;
}
.nav > li > a {
display: block;
color: black;
font-family: 'Oswald', sans-serif;
font-size: 1.2em;
font-weight: 500;
text-transform: uppercase;
height: 30px;
padding: 0 20px;
position: relative;
z-index: 510;
-webkit-transition: all .3s ease;
-moz-transition: all .3s ease;
-o-transition: all .3s ease;
-ms-transition: all .3s ease;
transition: all .3s ease;
}
.nav li:hover a {
background: black;
color: white;
}
.nav > li > div {
border: 1px solid black;
display: inline-block;
color: black;
position: absolute;
top: 30px;
left: calc(-50vw + 50%);
width: 100vw;
opacity: 0;
overflow: hidden;
visibility: hidden;
background: white;
z-index: 500;
-webkit-transition: all .3s ease .5s;
-moz-transition: all .3s ease .5s;
-o-transition: all .3s ease .5s;
-ms-transition: all .3s ease .5s;
transition: all .3s ease .5s;
}
.nav li:hover > div {
opacity: .7;
visibility: visible ;
overflow: hidden;
}
.nav .nav-column {
background-color: white;
float: left;
text-align: left;
top: -30px;
padding: 2%;
position: relative;
width: 15%;
}
.nav .nav-column h3 {
color: #d1a559;
font-family: Orator Std, IrisUPC, sans-serif;
font-weight: 900;
margin: 20px 0 10px 0;
text-decoration: underline ;
}
.nav .nav-column li {
padding-left: 0;
font-family: Palatino linotype, Rockwell;
}
.nav .nav-column li a {
background: white;
color: black;
display: block;
}
.nav .nav-column li a:hover {
background: #d1a559;
color: white;
-webkit-transition: all .1s ease;
-moz-transition: all .1s ease;
-o-transition: all .1s ease;
-ms-transition: all .1s ease;
transition: all .1s ease;
}
#media (max-width:1420px) {
.Thumbnails {
float: none;
}
}
#media (max-width: 950px) {
.nav li:hover > div {
background-color: white;
opacity: 1;
}
.nav .nav-column {
position: relative;
width: 20%;
}
.nav .nav-column li {
list-style: none;
}
}
#media (max-width: 700px) {
.nav li:hover > div {
background-color: white;
left: 0;
opacity: 1;
width: 100%;
}
.nav .nav-column {
float: none;
}
}
.colAbout {
display: block;
float: none;
}
.span_1_of_3 {
width: 70%;
}
#media (max-width: 530px) {
.nav {
display: none;
text-align: left;
height: 150px;
top: 0;
padding: 0;
margin: 0;
position: relative;
z-index: 999;
}
.nav li {
float: none;
left: 0;
}
.nav li:hover > div {
opacity: 1;
top: 113px;
}
.nav > li > a {
border-right: none;
display: block;
left: 0;
}
/*Div contendo responsive button*/
#menu {
border: 1px solid black;
color: black;
cursor: pointer;
display: block;
font-size: 1.3em;
left: 0;
margin: 5%;
position: relative;
text-align: center;
z-index: 540;
width: 1.4em;
}
#container {
left: 0;
display: block;
padding: 0;
position: relative;
width: 100%;
}
ul {
width: 100%;
list-style: none;
}
}
#media (min-width: 530px) {
#menu {
display: none;
}
}
And a fiddle example
If you just want to hide the scrollbar:
#container {
overflow: hidden!important;
}
I encountered the same issue. I still don't know the root cause, but setting overflow to "-moz-hidden-unscrollable" seems to hide the scrollbar.
.container {
overflow: -moz-hidden-unscrollable
}
I have checked your CSS. To prevent the scrollbar from being displayed, you should comment out two CSS properties: position: relative; top: 34px;
.nav {
cursor: default;
display: inline-block;
height: 125px;
width: auto;
-ms-flex-pack: center;
-ms-display: -ms-flexbox;
}
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 am trying to set behaviour for menu items in the header like here: http://www.germanamericanconference.org/partners/. There is a bar which slides back and forth when hovering on elements. In my case I can't add another element to my header and such effect should be purely CSS so instead I am using after pseudo-element.
Here, in the example: https://jsfiddle.net/1czmx08y/
As you can see there is a delay when moving between items but even if I decrease transition time, it starts twitching.
How can I avoid such behaviour? I feel like my transition is wrong.
Change all the transitions to 0.15s or 0.18s;
Isn't much better now? i think it would be better and it could be a better choice than using a plugin or more css or any js.
html {
font-family: 'Josefin Slab', 'Comfortaa', sans-serif;
font-size: 1.2em;
background: #eee;
}
ul {
position: relative;
width: 27em;
height: 2em;
margin: 100px auto;
padding: 0;
white-space: nowrap;
}
ul li {
display: inline;
text-align: center;
}
ul li a {
position: relative;
top: 0;
left: 0;
right: 25em;
bottom: 0;
display: inline-block;
-moz-box-sizing: border-box;
box-sizing: border-box;
padding: .4em .2em;
color: #09C;
text-decoration: none;
text-shadow: 0 1px 0 white;
/*transition*/
-webkit-transition: width .3s,right .3s;
-moz-transition: width .3s,right .3s;
-o-transition: width .3s,right .3s;
transition: width .19s,right .19s;
}
ul li:nth-child(1) a { width: 2em; }
ul li:nth-child(2) a { width: 4em; }
ul li:nth-child(3) a { width: 4em; }
ul li:nth-child(4) a { width: 12em; }
ul li:nth-child(5) a { width: 5em; }
ul li:last-child a::after {
content: "";
position: absolute;
right: inherit;
bottom: -3px;
width: inherit;
height: 3px;
background: #ccc;
pointer-events: none;
/*transition*/
-webkit-transition: all .5s ease;
-moz-transition: all .5s ease;
-o-transition: all .5s ease;
transition: all .19s ease;
}
ul li:nth-child(1) ~ li:last-child a {
right: 25em;
width: 2em;
}
ul li:nth-child(2):hover ~ li:last-child a {
right: 21em;
width: 4em;
}
ul li:nth-child(3):hover ~ li:last-child a {
right: 17em;
width: 4em;
}
ul li:nth-child(4):hover ~ li:last-child a {
right: 5em;
width: 12em;
}
ul li:nth-child(5):last-child:hover a {
right: 0;
width: 5em;
}
ul li:hover ~ li:last-child a::after,
ul li:last-child:hover a::after { background: #c351fa; }
ul li:last-child a {
min-width: 5em;
max-width: 5em;
}
ul li a:hover,
ul li a:focus {
color: #c351fa;
background-color: rgba(255,255,255,.6);
/*transition*/
-webkit-transition: width .3s,right .3s,background-color .3s;
-moz-transition: width .3s,right .3s,background-color .3s;
-o-transition: width .3s,right .3s,background-color .3s;
transition: width .19s,right .19s,background-color .19s;
}
ul li a:focus { border-bottom: 3px solid #c351fa; }
<ul>
<li> ✿ </li><!--
--><li> Lorem </li><!--
--><li> Ipsum </li><!--
--><li> Consectetur adipisicing </li><!--
--><li> Sit amet </li>
</ul>
I'm trying to have navigation menu items have underline effect when hovering. This is my current style.css code for the navigation menu.
What should I add to make it look something like this? Example: http://www.templatemonster.com/demo/54038.html .
This is my current nav bar code.
.navbar-nav .open .dropdown-menu{
display:block !important;
}
.navbar-default .navbar-nav > li > a {
color: #333;
border-bottom: 1px solid transparent;
padding: 0;
margin: 14px;
Try this..
HTML:
<ul>
<li>About</li>
</ul>
CSS:
body,html {
margin: 0;
}
ul {
margin: 150px auto 0;
padding: 0;
list-style: none;
display: table;
width: 600px;
text-align: center;
}
li {
display: table-cell;
position: relative;
padding: 15px 0;
}
a {
color: #000;
text-transform: uppercase;
text-decoration: none;
letter-spacing: 0.15em;
display: inline-block;
padding: 15px 20px;
position: relative;
}
a:after {
background: none repeat scroll 0 0 transparent;
bottom: 0;
content: "";
display: block;
height: 2px;
left: 50%;
position: absolute;
background: #000;
transition: width 0.3s ease 0s, left 0.3s ease 0s;
width: 0;
}
a:hover:after {
width: 100%;
left: 0;
}
https://jsfiddle.net/y4hc9Lbv/
I have a pre-existing responsive menu but I need to add a sub-navigation for each menu choice. How can I do this with CSS?
The important code, I think, is in the section primary navigation.
Thank you in advance for everyone that can help me to understand how sub-menus work.
/**
/* 06. =header styles
/* =================================================================== */
html,
body {
height: 100%;
}
body {
background: #0F1215;
font: 16px/30px "merriweather-regular", serif;
font-weight: normal;
color: #575859;
}
header {
height: 66px;
width: 100%;
position: fixed;
left: 0;
top: 0;
z-index: 600;
-moz-transition: all 0.5s ease-in-out;
-o-transition: all 0.5s ease-in-out;
-webkit-transition: all 0.5s ease-in-out;
-ms-transition: all 0.5s ease-in-out;
transition: all 0.5s ease-in-out;
}
header.opaque {
background: black;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
/* header logo */
header .logo {
background: #fdc501;
float: left;
width: auto;
margin-left: 15px;
margin-right: 30px;
z-index: 600;
/* add position relative since z-index only applies to
elements that have been given an explicit position */
position: relative;
}
header .logo a {
display: block;
margin: 0;
padding: 0;
border: none;
font: 0/0 a;
text-shadow: none;
color: transparent;
width: 114px;
height: 66px;
background: url("../images/logoK#2x.png") no-repeat center;
background-size: 61px 14px;
}
/* header social */
header .header-social {
font-size: 20px;
font-weight: normal;
line-height: 66px;
margin-top: 0;
margin-left: 30px;
padding-left: 36px;
border-left: 1px solid rgba(150, 150, 150, 0.2);
float: left;
position: relative;
top: -1px;
}
header .header-social li {
display: inline-block;
margin-right: 15px;
}
header .header-social li a {
color: #FFFFFF;
}
header .header-social li a:hover {
color: #fdc501;
}
/* media queries:
/* header/header components */
#media only screen and (max-width:880px) {
header .header-social {
display: none;
}
}
#media only screen and (max-width:768px) {
header {
background: black;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
header .row {
width: 100%;
}
header .logo {
margin-left: -30px;
}
}
/* primary navigation
--------------------------------------------------------------------- */
#nav-wrap,
#nav-wrap ul,
#nav-wrap li,
#nav-wrap a {
margin: 0;
padding: 0;
}
/* nav-wrap */
#nav-wrap {
font: 13px "raleway-heavy", sans-serif;
text-transform: uppercase;
letter-spacing: 1.5px;
float: left;
}
/* hide toggle button */
#nav-wrap > a {
display: none;
}
ul#nav {
min-height: 66px;
display: inline-block;
width: auto;
/* left align the menu */
text-align: left;
}
ul#nav li {
position: relative;
list-style: none;
display: inline-block;
height: 66px;
}
/* Links */
ul#nav li a {
/* 14px padding top + 14px padding bottom + 38px line-height = 66px */
display: block;
padding: 14px 12px;
line-height: 38px;
text-decoration: none;
text-align: left;
color: #FFFFFF;
position: relative;
-moz-transition: color 0.2s ease-in-out;
-o-transition: color 0.2s ease-in-out;
-webkit-transition: color 0.2s ease-in-out;
-ms-transition: color 0.2s ease-in-out;
transition: color 0.2s ease-in-out;
}
ul#nav li a:hover {
color: #fdc501;
}
ul#nav li a:active {
background-color: transparent !important;
}
ul#nav li.current a {
color: #fdc501;
}
ul#nav li.current a:after {
position: absolute;
left: 50%;
bottom: 0;
width: 40px;
height: 2px;
margin-left: -23px;
background-color: white;
content: '\0020';
display: block;
-moz-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
-webkit-transition: all 0.3s ease-in-out;
-ms-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
}
/* mobile navigation
--------------------------------------------------------------------- */
#media only screen and (max-width:768px) {
#nav-wrap {
z-index: 700;
display: block;
width: 100%;
float: none;
position: absolute;
top: 0;
right: 0;
}
/* mobile-btn and toggle-btn */
#nav-wrap > a {
border: none;
color: #FFFFFF;
height: 40px;
min-width: 40px;
font-size: 12px;
text-align: left;
float: right;
display: block;
padding: 0;
position: relative;
top: 13px;
right: 20px;
}
#nav-wrap > a:hover .menu-icon {
background: #FFFFFF;
}
#nav-wrap .menu-icon {
display: inline-block;
width: 24px;
height: 3px;
margin-top: -3px;
position: absolute;
right: 8px;
top: 50%;
bottom: auto;
left: auto;
background: #fdc501;
-moz-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
-webkit-transition: all 0.3s ease-in-out;
-ms-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
font: 0/0 a;
text-shadow: none;
color: transparent;
}
#nav-wrap .menu-icon:before,
#nav-wrap .menu-icon:after {
content: '';
width: 100%;
height: 100%;
position: absolute;
background-color: inherit;
left: 0;
}
#nav-wrap .menu-icon:before {
bottom: 8px;
}
#nav-wrap .menu-icon:after {
top: 8px;
}
/* dropdown nav */
#nav-wrap ul#nav {
background: #1c212a;
padding: 54px 45px 60px 45px;
margin: 0;
height: auto;
display: none;
clear: both;
width: 100%;
float: none;
position: absolute;
top: 66px;
right: 0;
}
#nav-wrap ul#nav > li {
display: block;
float: none;
height: auto;
text-align: left;
border-bottom: 1px dotted rgba(200, 200, 200, 0.1);
padding: 6px 0;
}
#nav-wrap ul#nav > li:first-child {
border-top: 1px dotted rgba(200, 200, 200, 0.1);
}
#nav-wrap ul#nav li a {
display: block;
width: auto;
padding: 0;
color: #cacbcb;
padding: 12px 0;
line-height: 16px;
border: none;
}
#nav-wrap ul#nav li a:hover {
color: #FFFFFF;
}
#nav-wrap ul#nav li.current > a {
background: none;
color: #fdc501;
}
#nav-wrap ul#nav li.current > a:after {
display: none;
}
#nav-wrap a.mobile-btn {
display: none;
}
.js #nav-wrap a#toggle-btn {
display: block;
}
/* if js is disabled */
.no-js #nav-wrap:not(:target) > a:first-of-type,
.no-js #nav-wrap:target > a:last-of-type {
display: block;
}
.no-js #nav-wrap:target ul#nav {
display: block;
}
}
/* make sure the menu is visible on larger screens
--------------------------------------------------------------------- */
#media only screen and (min-width:769px) {
#nav-wrap ul#nav {
display: block !important;
}
}
<header id="main-header">
<div class="row">
<div class="logo">
SAT | Aloia Evelina
</div>
<nav id="nav-wrap">
<a class="mobile-btn" href="#nav-wrap" title="Show navigation">
<span class="menu-icon">Menu</span>
</a>
<a class="mobile-btn" href="#" title="Hide navigation">
<span class="menu-icon">Menu</span>
</a>
<ul id="nav" class="nav">
<li><a class="smoothscroll" href="#hero">Home.</a></li>
<li class="current"><a class="smoothscroll" href="#portfolio">Works.</a></li>
<li><a class="smoothscroll" href="#services">Services.</a></li>
<li><a class="smoothscroll" href="#about">About.</a></li>
<li><a class="smoothscroll" href="#contact">Contact.</a></li>
</ul> <!-- end #nav -->
</nav> <!-- end #nav-wrap -->
<ul class="header-social">
<li><i class="fa fa-facebook"></i></li>
<li><i class="fa fa-twitter"></i></li>
<li><i class="fa fa-google-plus"></i></li>
</ul>
</div>
</header> <!-- end header -->
<ul id="nav" class="nav">
<li><a class="smoothscroll" href="#hero">Home.</a>
<ul>
<li>#item1</li>
<li>#item1</li>
</ul>
</li>
<li class="current"><a class="smoothscroll" href="#portfolio">Works.</a>
<ul>
<li>#item1</li>
<li>#item1</li>
</ul>
</li>
<li><a class="smoothscroll" href="#services">Services.</a>
<ul>
<li>#item1</li>
<li>#item1</li>
</ul>
</li>
<li><a class="smoothscroll" href="#about">About.</a>
<ul>
<li>#item1</li>
<li>#item1</li>
</ul>
</li>
<li><a class="smoothscroll" href="#contact">Contact.</a>
<ul>
<li>#item1</li>
<li>#item1</li>
</ul>
</li> </ul>
in your html file you code should look something like this.
and then for more details on how you can style your code you can visit the site https://css-tricks.com/targetting-menu-elements-submenus-navigation-bar/
It provides some tricks in which you can style your menu as well as I how the html file should look like. I find it very much helpfull.