Width problems when giving relative position value - html

When I try to set the position of a button as "relative" in this specific web.
the width of the page gets increased as you can see by the code provided in snippet, will appreciate if you take a look (Specifically "btn-links1 & btn-links2" classes)
(Absolute value doesn't work as the buttons get misplaced when minimizing the browser window)
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
:root {
--main-color: #00C9A6;
--second-color: #27242B;
--third-color: #545058;
--fourth-color: #FAEAFF;
}
html {
scroll-behavior: smooth;
}
body {
background-color: var(--third-color);
font-family: 'Roboto', sans-serif;
}
.nav-bar {
-webkit-backdrop-filter: blur(8px);
backdrop-filter: blur(8px);
display: flex;
position: fixed;
padding: 15px;
/* background-color: var(--second-color); */
width: 100%;
height: 60px;
z-index: 1030;
}
.active {
border-bottom: 1px solid var(--fourth-color);
}
.logo {
position: relative;
bottom: 4px;
height: 40px;
display: inline-block;
background-color: var(--fourth-color);
transition: .2s;
}
.logo img {
width: 50px;
}
.logo:hover {
opacity: .5;
}
.nav-bar .links li {
padding: 7px;
display: inline-block;
justify-content: space-around;
}
.nav-bar .links {
left: 30px;
position: relative;
/* margin: 10px 0; */
}
.nav-bar .links li a {
list-style: none;
text-decoration: none;
margin-top: 15px;
padding: 0 15px 0 15px;
color: var(--main-color);
text-transform: capitalize;
font-weight: 700;
transition: .2s ease-in-out;
}
.nav-bar .links li:hover a {
color: #00c9a7b9;
}
#home {
position: relative;
width: 100%;
height: 500px;
background-color: var(--third-color);
z-index: 1;
}
.img{
background-image: url(../imgs/Dustin+vs+Claudio_.jpg);
position: absolute;
background-size: cover;
width: 100%;
height: 500px;
z-index: 2;
}
.overlay {
position: absolute;
width: 100%;
height: 500px;
background-color: rgba(33, 31, 35, 0.569);
z-index: 3;
}
.titles h1 {
position: absolute;
font-size: 100px;
font-style: italic;
color: var(--main-color);
z-index: 4;
text-align: center;
top: 0;
left: 170px;
margin: 155px 0;
padding: 5px;
text-transform: capitalize;
}
/* start Button styling */
.btn-link1 {
position: relative;
left: 297px;
bottom: 208px;
text-decoration: none;
}
.btn-link1 a{
position: absolute;
width: 0;
text-decoration: none;
}
.button-86 {
all: unset;
width: 100px;
height: 30px;
font-size: 16px;
background: transparent;
border: none;
position: relative;
color: var(--third-color);
cursor: pointer;
z-index: 1;
padding: 10px 20px;
display: flex;
align-items: center;
justify-content: center;
white-space: nowrap;
user-select: none;
-webkit-user-select: none;
touch-action: manipulation;
}
.button-86::after,
.button-86::before {
content: '';
position: absolute;
bottom: 0;
right: 0;
z-index: -99999;
transition: all .4s;
}
.button-86::before {
transform: translate(0%, 0%);
width: 100%;
height: 100%;
background: var(--fourth-color);
border-radius: 10px;
}
.button-86::after {
transform: translate(10px, 10px);
width: 35px;
height: 35px;
background: #ffffff15;
backdrop-filter: blur(5px);
-webkit-backdrop-filter: blur(5px);
border-radius: 50px;
}
.button-86:hover::before {
transform: translate(5%, 20%);
width: 110%;
height: 110%;
background-color: var(--main-color);
}
.button-86:hover::after {
border-radius: 10px;
transform: translate(0, 0);
width: 100%;
height: 100%;
}
.button-86:active::after {
transition: 0s;
transform: translate(0, 5%);
}
.btn-link1 a span {
font-weight: bold;
transition: all .3s ease-in 0s;
}
.btn-link1:hover a span {
/* font-weight: bold; */
color: black;
}
.btn-link1:hover .fa-instagram {
color: black;
}
.fa-instagram {
/* font-weight: bold; */
color: rgb(120, 5, 221);
margin: 5px;
transition: all .3s ease-in 0s;
}
/* end Button instagram styling */
/* start Button linked in styling */
.btn-link2 {
position: relative;
left: 575px;
bottom: 208px;
text-decoration: none;
}
.btn-link2 a{
position: absolute;
width: 0;
text-decoration: none;
}
.button-87 {
all: unset;
width: 100px;
height: 30px;
font-size: 16px;
background: transparent;
border: none;
position: relative;
color: var(--third-color);
cursor: pointer;
z-index: 1;
padding: 10px 20px;
display: flex;
align-items: center;
justify-content: center;
white-space: nowrap;
user-select: none;
-webkit-user-select: none;
touch-action: manipulation;
}
.button-87::after,
.button-87::before {
content: '';
position: absolute;
bottom: 0;
right: 0;
z-index: -99999;
transition: all .4s;
}
.button-87::before {
transform: translate(0%, 0%);
width: 100%;
height: 100%;
background: var(--fourth-color);
border-radius: 10px;
}
.button-87::after {
transform: translate(10px, 10px);
width: 35px;
height: 35px;
background: #ffffff15;
backdrop-filter: blur(5px);
-webkit-backdrop-filter: blur(5px);
border-radius: 50px;
}
.button-87:hover::before {
transform: translate(5%, 20%);
width: 110%;
height: 110%;
background-color: var(--main-color);
}
.button-87:hover::after {
border-radius: 10px;
transform: translate(0, 0);
width: 100%;
height: 100%;
}
.button-87:active::after {
transition: 0s;
transform: translate(0, 5%);
}
.btn-link2 a span {
font-weight: bold;
transition: all .3s ease-in 0s;
}
.btn-link2:hover a span {
/* font-weight: bold; */
color: rgb(0, 162, 255);
}
.btn-link2:hover .fa-linkedin {
color: black;
}
.fa-linkedin {
color: rgb(0, 162, 255);
margin: 5px;
transition: all .3s ease-in 0s;
}
/* end Button linked in styling */
<div class="nav-bar">
<a class="logo" href="#home">
<img src="imgs/lw-logo.png" alt="">
</a>
<ul class="links">
<li class="active">home</li>
<li>portraits</li>
<li>behind the scenes</li>
<li>action</li>
<li>fine art</li>
<li>contact me</li>
</ul>
</div>
<div id="home">
<div class="background">
<div class="img"></div>
<div class="overlay"></div>
</div>
<div class="titles">
<h1>lw photography</h1>
</div>
</div>
<div class="btn-link1">
<a href="https://www.instagram.com">
<button class="button-86" role="button">
<i class="fa-brands fa-instagram"></i>
<span>Instagram</span>
</button>
</a>
</div>
<div class="btn-link2">
<a href="https://www.linkedin.com/in/lane-walbert-0b838a9a/">
<button class="button-87" role="button">
<i class="fa-brands fa-linkedin"></i>
<span>LinkedIn</span>
</button>
</a>
</div>
Scroll bar down bottom as page width got increased

Related

Div moves over other one on diferent device scales

So I have this problem, I have Static web page, and i have header section and few others.
But currently right now. Whatever section i set to be under the header section, its just move over the header.
This is first time this is happening, and i cant reslove it.
On first i tought its problem in browser, but it is same on every one that i tried.
I think it is problem in the image on header section so i placed it above the txt section on the header, but section below header stil overlaps on the header.
Soo I double checked all code on header and I think there was nothing wrong that
could cause this.
header {
margin: auto;
height: 100vh;
}
.navigation-menu {
z-index: 10000;
display: flex;
align-items: center;
background: #fff;
box-shadow: 0 1px 1px #333;
justify-content: space-between;
position: fixed;
width: 100%;
left: 0;
top: 0;
padding: 20px 20px;
}
.navigation-menu nav ul {
word-spacing: 10px;
}
.navigation-menu nav ul li {
list-style-type: none;
display: inline-block;
}
.navigation-menu nav ul li a {
font-size: 19px;
}
/*
===== Hamburger Menu =====
*/
.navigation-menu .hamburger {
padding: 5px;
position: relative;
display: none;
cursor: pointer;
right: 40px;
border: none;
background: none;
outline: none;
appearance: none;
}
.navigation-menu .hamburger .bar {
transition: .3s ease all;
position: relative;
display: block;
margin-bottom: 5px;
width: 30px;
height: 3px;
background: #333;
border-radius: 26px;
}
.hamburger.is-active .bar:nth-last-child(1) {
transform: rotate(-45deg) translate(4px, -5px);
}
.hamburger.is-active .bar:nth-last-child(2) {
transform: translateX(-10px);
opacity: 0;
}
.hamburger.is-active .bar:nth-last-child(3) {
transform: rotate(45deg) translate(6px, 8px);
}
.mobile-menu {
transition: .3s ease all;
transform: translateX(100%);
position: fixed;
display: none;
align-items: center;
justify-content: space-around;
left: 0;
top: 0;
width: 100%;
padding-top: 120px;
height: 100vh;
z-index: 2;
background: #fff;
}
.mobile-menu.menu-show {
transform: translateX(0%);
}
.mobile-menu ul {
word-spacing: 10px;
}
.mobile-menu ul li {
list-style-type: none;
}
.mobile-menu ul li a {
font-family: 'Playfair Display', serif;
margin-bottom: 5px;
transition: .3s ease all;
font-size: 45px;
}
.mobile-menu ul li a:hover {
color: red;
}
#media (max-width:533px) {
.navigation-menu nav {
display: none;
}
.navigation-menu .hamburger {
display: block;
}
.mobile-menu {
display: flex;
}
}
/*
===== Hamburger Menu =====
*/
.heading__container {
position: relative;
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: center;
height: 100vh;
}
.heading__content {
position: relative;
margin: 6%;
display: block;
}
.heading__title h1{
font-weight: 900;
text-transform: uppercase;
font-size: 55px;
}
.heading__title h1 span {
color: red;
}
.heading__subtitle p{
font-size: 22px;
}
.heading__subtitle {
max-width: 600px;
width: 100%;
}
.heading__image {
padding: 1em;
position: relative;
text-align: center;
}
.heading__image img {
max-width: 400px;
width: 100%;
}
.heading__button-box .btn__read {
background: red;
border: solid 1px red;
}
.heading__button-box .btn__read a {
color: #fff;
}
.heading__button-box .btn__react {
position: relative;
}
.heading__button-box .btn__react::before {
position: absolute;
content: '';
left: 0;
bottom: 0;
background: red;
z-index: -1;
height: 0;
transition: .3s ease all;
width: 100%;
}
.heading__button-box .btn__react:hover::before {
height: 100%;
}
.heading__button-box button {
margin-bottom: 1%;
margin-right: 5%;
}
.heading__button-box .btn__react a {
transition: .3s ease all;
}
.heading__button-box .btn__react:hover {
border: solid 1px red;
}
.heading__button-box .btn__react:hover a {
color: #fff;
}
.heading__button-box .btn__react {
border: solid 1px red;
}
.h__wrapper {
margin-top: 50px;
}
.h__wrapper .h__button {
display: inline-block;
overflow: hidden;
height: 60px;
width: 60px;
float: left;
border-radius: 50px;
cursor: pointer;
margin: 10px 5px;
transition: .3s ease all;
box-shadow: 0 2px 12px #333;
}
.h__wrapper .h__button:hover {
width: 200px;
}
.h__wrapper .h__button .icon {
height: 60px;
width: 60px;
transition: .3s ease all;
border-radius: 50px;
text-align: center;
line-height: 60px;
box-sizing: border-box;
display: inline-block;
}
.h__wrapper .h__button .icon i {
font-size: 25px;
line-height: 60px;
}
.h__wrapper .h__button span {
font-size: 20px;
line-height: 60px;
margin-left: 10px;
font-weight: 500;
}
.h__wrapper .h__button:nth-child(1) .icon {
background: #fff;
}
.h__wrapper .h__button:nth-child(1):hover .icon {
background: rgb(126, 168, 245);
}
.h__wrapper .h__button:nth-child(1):hover .icon i{
color: #fff;
}
.h__wrapper .h__button:nth-child(2) .icon {
background: #fff;
}
.h__wrapper .h__button:nth-child(2):hover .icon {
background: rgb(214, 146, 20);
}
.h__wrapper .h__button:nth-child(2):hover .icon i{
color: #fff;
}
.h__wrapper .h__button:nth-child(3) .icon {
background: #fff;
}
.h__wrapper .h__button:nth-child(3):hover .icon {
background: #333;
}
.h__wrapper .h__button:nth-child(3):hover .icon i{
color: #fff;
}
<header>
<div class="navigation-menu">
<img src="../assets/images/logo/Anima.png" alt="">
<nav>
<ul>
<li>Home</li>
<li>Services</li>
<li>About</li>
<li>Works</li>
<li>Projects</li>
</ul>
</nav>
<div class="hamburger">
<span class="bar"></span>
<span class="bar"></span>
<span class="bar"></span>
</div>
</div>
<nav class="mobile-menu">
<ul>
<li>Home</li>
<li>About</li>
<li>Services</li>
<li>Works</li>
<li>Projects</li>
</ul>
</nav>
<section class="heading__container">
<div class="heading__content">
<div class="heading__title">
<h1><span>Emanuel</span> <br> Rajic</h1>
</div>
<div class="heading__subtitle">
<p>I am 16 years old Front-end developer and CS Student</p>
</div>
<div class="heading__button-box">
<button class="btn__read">Read More</button>
<button class="btn__contact btn__react">Get In Touch</button>
</div>
<div class="h__wrapper">
<div class="h__button">
<div class="icon"><i class="fab fa-twitter"></i></div>
<span>Twitter</span>
</div>
<div class="h__button">
<div class="icon"><i class="fab fa-instagram"></i></div>
<span>Instagram</span>
</div>
<div class="h__button">
<div class="icon"><i class="fab fa-github"></i></div>
<span>Github</span>
</div>
</div>
</div>
<div class="heading__image">
<img src="../assets/images/header/valentin-salja-0aX51h4WvAk-unsplash.jpg">
</div>
</section>
</header>
A combination of z-index:10000, which will give this element priority over everything (so being on top all the time), and position:fixed, which will make that element have a fixed position in the said place no matter the scrolling are, the culprits. Removing those two CSS properties would fix your "issue".

Why can I click the li when the navbar isn't showed?

Ok so I have a problem with my navbar on mobile. It is hidden and it displays only when I press the bar (toggler). The problem is: if I press on the screen when the navbar isn't displayed it still goes to the links, even if I can't see the li's.
I want to keep the same navbar but I don't want to acces the links when it is closed.
If its possible please tell me how to solve it and the problems of my navbar
This is my code:
.banner {
margin: 0px;
position: relative;
width: 100%;
height: 100vh;
background-size: cover;
background-image: linear-gradient(to left, rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.6)), url(../img/pozabackground-home2.jpg);
background-position: center;
box-shadow: 1px 2px 4px 0px #00000075 !important;
background-attachment: fixed;
}
.navigatie {
background-color: transparent;
width: 100%;
position: fixed;
z-index: 99;
margin: 0px;
padding: 0px;
}
.logo {
float: left;
padding: 8px;
margin-left: 40px;
margin-top: 8px;
}
.navbar-brand {
color: white !important;
}
.navbar-brand img {
width: auto;
height: 100px;
margin: -32px 0px -25px 0px;
}
nav ul {
float: right;
list-style-type: none;
padding-top: 5px;
margin-right: 20px;
}
nav ul li {
float: left;
}
nav ul li:not(:first-child) {
margin-left: 48px;
}
nav ul li:last-child {
margin-right: 24px;
}
nav ul li a {
display: inline-block;
outline: none;
color: #fff;
text-transform: uppercase;
text-decoration: none;
font-size: 13px;
letter-spacing: 1.1px;
font-weight: 600;
}
nav ul li a:hover {
color: #fff;
text-decoration: underline;
}
/* FUNDAL JS */
.fundal {
background: #104f47 !important;
box-shadow: 1px 2px 4px 0px #00000075 !important;
}
.fundal .nav-btn {
background-color: #104f47;
border-radius: 50%;
box-shadow: 1px 2px 4px 0px #00000075;
}
.fundal .nav-btn i {
background: #fff;
border-radius: 2px;
}
#nav:checked+.nav-btn {
transform: rotate(45deg);
background-color: #104f47;
}
#nav:checked+.nav-btn i {
background: #fff;
transition: transform 0.2s ease;
}
#nav:checked+.nav-btn i:nth-child(1) {
transform: translateY(6px) rotate(180deg);
}
#nav:checked+.nav-btn i:nth-child(2) {
opacity: 0;
}
#nav:checked+.nav-btn i:nth-child(3) {
transform: translateY(-6px) rotate(90deg);
}
#nav:checked~.nav-wrapper {
z-index: 9990;
opacity: 1;
}
#nav:checked~.nav-wrapper ul li a {
opacity: 1;
transform: translateX(0);
}
.hidden {
display: none;
}
/* MEDIA SCREEN PTR TLF */
#media only screen and (max-width: 991px) {
.navigatie {
background-color: transparent;
width: 100%;
position: absolute;
;
z-index: 99;
margin: 0px;
padding: 0px;
}
.navbar-brand img {
height: 100px;
margin: -20px 0px 0px 0px;
}
.nav-wrapper {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -1;
background: #fff;
opacity: 0;
transition: all 0.2s ease;
}
.nav-wrapper ul {
position: absolute;
top: 50%;
transform: translateY(-50%);
width: 100%;
}
.nav-wrapper ul li {
display: block;
float: none;
width: 100%;
text-align: right;
padding-top: 10px;
margin-bottom: 10px;
}
.nav-wrapper ul li:nth-child(1) a {
transition-delay: 0.2s;
}
.nav-wrapper ul li:nth-child(2) a {
transition-delay: 0.3s;
}
.nav-wrapper ul li:nth-child(3) a {
transition-delay: 0.4s;
}
.nav-wrapper ul li:nth-child(4) a {
transition-delay: 0.5s;
}
.nav-wrapper ul li:not(:first-child) {
margin-left: 0;
}
.nav-wrapper ul li a {
padding: 10px 24px;
opacity: 0;
color: #000;
font-size: 14px;
font-weight: 600;
letter-spacing: 1.2px;
transform: translateX(-20px);
transition: all 0.2s ease;
}
.nav-btn {
position: fixed;
right: 30px;
top: 28px;
display: block;
width: 48px;
height: 46px;
cursor: pointer;
z-index: 9999;
border-radius: 50%;
}
.nav-btn i {
display: block;
width: 20px;
height: 2px;
background: #fff;
border-radius: 2px;
margin-left: 14px;
}
.nav-btn i:nth-child(1) {
margin-top: 16px;
}
.nav-btn i:nth-child(2) {
margin-top: 4px;
opacity: 1;
}
.nav-btn i:nth-child(3) {
margin-top: 4px;
}
}
/* SCRIS DE LA BANNER */
.title {
position: absolute;
top: 47%;
left: 35%;
text-align: left;
transform: translate(-50%, -50%);
}
.title h1 {
color: #fff;
font-family: poppins;
font-size: 50px;
color: #f5f6f8;
padding-bottom: 20px;
}
.button button {
display: inline-block;
font-size: 12px;
text-transform: uppercase;
text-align: center;
padding: 13px 20px;
border: none;
color: white;
font-family: montserrat;
text-decoration: none;
transition: 0.6s ease;
background-color: #104f47;
box-shadow: 1px 2px 4px 0px #00000075;
outline: none;
}
.button button:hover {
background-color: #104f47;
color: white;
}
<div class="navigatie">
<nav>
<input type="checkbox" id="nav" class="hidden">
<label for="nav" class="nav-btn">
<i></i>
<i></i>
<i></i>
</label>
<div class="logo">
<a class="navbar-brand" href="index.php"><img src="./img/logoinainte.png"></a>
</div>
<div class="nav-wrapper">
<ul>
<li>Acasa</li>
<li>Despre</li>
<li>Servicii</li>
<li>Tarife</li>
<li>Contact</li>
</ul>
</div>
</nav>
</div>
<section class="banner">
<div class="container">
<div class="title">
<h1>Aspect curat <br>și îmbunătățit al <br>locuinței tale</h1>
<div class="button">
<button type="button">Sună acum!</button>
</div>
</div>
</div>
</section>
Could you tell me what is the problem?
You are using opacity. With opacity the element becomes invisible but it is still there. You have to set its display to none. And when the button is clicked you have to set its display to block.
.nav-wrapper {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -1;
background: #fff;
display:none;
transition: all 0.2s ease;
}
#nav:checked ~ .nav-wrapper {
z-index: 9990;
display:block
}

Hamburger dropdown overlapped by Hero image content

I have a dynamic clip-path dropping down from the top-right corner on the hamburger menu click. Everything works fine except the content from my Hero image is overlapping. I tried z-index, but these are all position absolute so it has no effect. If I change the position it screws up the whole page. This project is being built in Django, but that doesn't seem to matter much here.
HTML
{% load static %}
<header class="nav-down">
<nav>
<div class="hamburger">
<i class="fas fa-bars"></i>
</div>
<ul class="nav-links">
<li>Home</li>
<li>News</li>
<li>Library</li>
<li>Search</li>
<li>About</li>
</ul>
</nav>
</header>
CSS
/* ===========================================
RESET CSS BEGIN*
=========================================== */
* {
margin: 0;
padding: 0;
}
body,
html {
margin: 0;
padding: 0;
height: 100%;
box-sizing: border-box;
font-family: 'Montserrat', sans-serif;
position: relative;
}
a {
color: #fff;
}
li {
list-style: none;
}
#html-container {
min-height: 100%;
}
#main {
overflow: scroll;
padding-bottom: 81px;
}
/*RESET CSS END*/
.showcase {
background-image: linear-gradient(
to bottom,
rgba(0, 0, 0, 0.2),
rgba(0, 0, 0, 0.2)
),
url(/static/img/vg_home.jpeg);
height: 100vh;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.showcase-content-top {
position: relative;
top: 25%;
left: 50%;
transform: translate(-50%, -50%);
color: #fff;
margin-bottom: 20px;
text-align: center;
text-transform: uppercase;
}
.showcase-content-top h1 {
font-weight: 900;
font-size: 5vw;
}
.text-color {
color: rgb(151, 193, 92);
}
#wave {
height: 100px;
width: 100px;
border: 10px solid silver;
position: absolute;
top: 34.15%;
left: 46.2%;
z-index: -1;
transform: translate(-50%, -50%);
border-radius: 50%;
-webkit-animation: pulseEffect 4s infinite linear;
animation: pulseEffect 4s infinite linear;
}
#-webkit-keyframes pulseEffect {
from {
transform: translate(-50%, -50%) scale(0.5);
border: 0px solid silver;
opacity: 0;
}
to {
transform: translate(-50%, -50%) scale(1);
border: 10px solid rgb(151, 193, 92);
opacity: 1;
}
}
#keyframes pulseEffect {
from {
transform: translate(-50%, -50%) scale(0.5);
opacity: 0.4;
}
to {
transform: translate(-50%, -50%) scale(3);
opacity: 0;
}
}
.separator {
color: rgb(151, 193, 92);
}
.sub {
font-size: 1.5vw;
vertical-align: middle;
}
.showcase-content-buttons > ul {
display: inline;
text-align: center;
position: absolute;
top: 85%;
left: 50%;
transform: translate(-50%, -50%);
list-style: none;
padding: 0;
}
.showcase-content-buttons a {
margin: 20px;
color: #fff;
border: 1px solid #fff;
padding: 10px 40px;
transition: 0.75s;
}
.showcase-content-buttons a:hover {
background-color: rgb(151, 193, 92);
border: 1px solid rgb(151, 193, 92);
text-decoration: none;
color: #fff;
}
/* ===========================================
NAV BAR STYLING // START
=========================================== */
header {
background: rgb(25, 25, 25);
height: 81px;
position: fixed;
transition: top 0.5s ease-in-out;
width: 100%;
}
.nav-up {
top: -81px;
}
nav {
position: relative;
height: 81px;
background: rgb(25, 25, 25);
}
.nav-links {
display: flex;
list-style: none;
width: 50%;
height: 100%;
justify-content: space-around;
align-items: center;
margin-left: auto;
}
.nav-links li a {
font-size: 20px;
text-decoration: none;
color: #fff;
}
.hamburger {
display: none;
}
/*Navigation Bar styling // END*/
/* ===========================================
About Page Styling // Start
=========================================== */
.about-container {
display: block;
margin: auto;
max-width: 65%;
height: 85%;
background-color: rgba(200, 200, 200, 0.05);
border-radius: 20px;
}
.about-container h6 {
color: #fff;
text-align: center;
margin-right: 250px;
padding-top: 60px;
font-size: 2.5rem;
letter-spacing: 1.5px;
}
.about-container .large {
color: rgba(114, 245, 190);
letter-spacing: 3.5px;
font-size: 3.5rem;
}
.about-container .paragraph {
color: #fff;
font-size: 1rem;
letter-spacing: 1px;
padding-left: 20px;
padding-right: 20px;
line-height: 2rem;
}
/*About Page Styling // End*/
/* ===========================================
FOOTER STYLES // START
=============================================*/
#footer {
position: relative;
height: 81px;
margin-top: -81px;
background: rgb(25, 25, 25);
color: white;
text-align: center;
clear: both;
z-index: 1;
}
.footer-content {
margin: auto;
max-width: 100%;
font-size: 1.25vw;
padding: 5px 0;
}
.page-content > p > img {
max-width: 2vh;
height: auto;
}
p.logos {
max-width: 100%;
height: auto;
margin-bottom: 0;
}
footer h1 {
font-size: 20px;
color: white;
font-weight: bold;
}
footer a {
color: #fff;
border-bottom: 1px solid transparent;
transition: 0.3s;
}
footer a:hover {
text-decoration: none;
color: #fff;
border-bottom: 1px solid rgb(151, 193, 92);
}
/*FOOTER STYLES END*/
/* ============= RESPONSIVE max-width: 991p =========== */
#media screen and (max-width: 768px) {
#wave {
display: none;
}
.hamburger i {
position: absolute;
width: 100%;
margin: auto;
color: #fff;
top: 25%;
right: -30%;
font-size: 40px;
}
nav {
position: relative;
}
.hamburger {
position: absolute;
display: flex;
cursor: pointer;
background: rgb(151, 193, 92);
height: 81px;
width: 100px;
right: 0;
top: 0;
transform: translate(-5%, 0%);
z-index: 3;
}
.nav-links {
position: absolute;
background: rgb(151, 193, 92);
height: 100vh;
width: 100%;
flex-direction: column;
clip-path: circle(100px at 100% -20%);
-webkit-clip-path: circle(100px at 100% -20%);
transition: all 1s ease-out;
pointer-events: none;
z-index: 2;
}
.nav-links.open {
clip-path: circle(1400px at 100% -10%);
-webkit-clip-path: circle(1400px at 100% -10%);
pointer-events: all;
}
}
/* ============= RESPONSIVE max-width: 768px =========== */
#media screen and (max-width: 768px) {
}
/* ============= RESPONSIVE max-width: 385px=========== */
#media screen and (max-width: 385px) {
}
Before the dropdown is initiated
An image of what it looks like once the dropdown is fully encompensing the screen
Sorry guys, I asked it too quickly. I just needed to give the header tag a z-index, not the nav tag. Working now.

width 100% causes horizontal scrollbar

I've created a page with HTML and CSS, the problem is horizontal scrollbar is showing up although as far as I've checked there is no element with width over 100% or inappropriate padding or margin.
here is the complete HTML and CSS code: https://jsfiddle.net/m11nsbag/9/
#keyframes modalAnimation {
from {
top: 90vh;
}
to {
top: 95vh;
background-color: darkcyan;
box-shadow: 5px 5px 25px #747474;
}
}
#headerImage {
width: 100vw;
height: 100vh;
overflow: hidden;
position: fixed;
padding: 0px;
margin: 0px;
z-index: -10000000;
}
#main-nav>li {
width: 9vw;
height: 7vh;
color: #ffffff;
float: right;
text-align: center;
line-height: 7vh;
margin: 0px;
font-size: medium;
z-index: 100;
list-style-type: none;
transition: 0.25s;
}
#main-nav {
background-color: rgba(245, 255, 249, 0.5);
width: 100%;
height: 7vh;
position: fixed;
z-index: 100;
float: right;
transition: all 0.25s;
}
/*
#main-nav:hover {
background-color: rgba(0,129,129,1);
} */
#main-nav>li:hover {
background-color: rgb(232, 255, 92);
}
#wall {
background-color: #d2d2d2;
width: 100%;
height: 100vh;
z-index: -10;
}
* {
margin: 0px;
padding: 0px;
}
#main-nav>li>a {
color: #000;
text-decoration: none;
}
.modalLayout {
opacity: 0;
}
.modalLayout:target {
position: fixed;
background-color: rgba(0, 0, 0, 0.5);
width: 100vw;
height: 100vh;
opacity: 1;
transition: all 0.4s;
z-index: 200;
}
.modal {
text-align: center;
padding: 6% 1% 1.7% 1%;
width: 30vw;
height: 20vh;
margin: 30vh 35vw;
background-color: crimson;
position: fixed;
transition: all 0.4s;
z-index: 10;
border-radius: 10px;
box-shadow: 2px 2px #484848;
}
.closeBtn {
font-size: 35px;
position: absolute;
top: 25vh;
right: 33vw;
float: right;
color: #fff;
font-weight: bold;
text-decoration: none;
z-index: 1000;
cursor: pointer;
margin-right: 5px;
transition: all 0.4s;
}
.mainPageButton>div {
display: none;
}
.mainPageButton:hover>div {
display: block;
transition: all 0.25s;
}
.mainPageButton>div>div {
width: 15vw;
height: 8vh;
background-color: #d2d2d2;
color: #000;
font-size: medium;
float: top;
border-bottom: black 1px solid;
list-style-type: none;
position: relative;
line-height: 8vh;
}
.mainPageButton>div>div>a {
text-decoration: none;
color: #fff;
font-size: medium;
text-align: center;
list-style-type: none;
background-color: #d2d2d2;
padding-right: 2px;
}
.mainMenu {
position: absolute;
top: 88vh;
z-index: 0;
margin-right: 1vw;
}
.mainMenu>div {
width: 15vw;
height: 10vh;
border-bottom: black solid 2px;
margin-bottom: 3vh;
background-color: white;
transition: all .3s;
text-align: center;
line-height: 10vh;
}
.mainMenu>div:hover {
width: 17vw;
height: 12vh;
background-color: #ffcfce;
}
.mainMenu>div>a {
font-size: x-large;
color: #000;
cursor: pointer;
text-decoration: none;
}
.about {
width: 20vw;
height: 40vh;
background-color: #94ffca;
border-radius: 5px;
position: absolute;
top: 88vh;
left: 0;
float: left;
font-size: larger;
padding: 1vw;
transition: all 0.3s;
margin-left: 4px;
overflow: auto;
}
.about:hover {
transform: translate(5px);
background-color: rgba(148, 255, 202, 0.5);
}
#modalcontainer {
background-color: rgba(256, 256, 256, 0.75);
top: 80vh;
position: absolute;
width: 100vw;
height: 200%;
z-index: -10;
border-top-left-radius: 50px;
border-top-right-radius: 50px;
}
#modalswall {
width: 50vw;
height: 150vh;
background-color: #0d213c;
position: absolute;
top: 85vh;
right: 20vw;
z-index: -5;
border-radius: 8px;
box-shadow: 20px 20px 25px grey;
filter: opacity(90%);
}
.bodyModals {
background-color: #acd7ff;
top: 90vh;
width: 35vw;
height: 25vh;
right: 28vw;
position: relative;
z-index: 5;
border-radius: 10px;
transition: all .5s;
margin-bottom: 10vh;
}
.bodyModals:hover {
-webkit-animation: modalAnimation;
-webkit-animation-duration: 3s;
-webkit-animation-direction: alternate;
-webkit-animation-iteration-count: infinite;
}
.bodyModals>p {
padding: 1vw;
font-size: large;
}
#wrapper {
margin-bottom: 170vh;
position: relative;
}
#footer {
position: relative;
width: 100vw;
min-height: 25vh;
bottom: 0;
background-color: #0d213c;
}
#footer>p {
font-size: large;
text-align: center;
color: #fff;
padding: 10px 0px;
}
html,
body {
height: 100%;
margin: 0;
padding: 0;
}
I think there maybe a padding or margin which I'm overlooking but I've been looking at it for several hours and tried almost anything.
thanks for your sincere help.
Update: I changed all the 100vw with 100% and the problem was fixed.
Vertical scrollbars are included in vw units.
So when there's a vertical scrollbar, 100vw is wider than the viewport (without scrollbars).
One suggestion is to change #modalcontainer to width:100% instead of width:100vw.
#keyframes modalAnimation {
from {
top: 90vh;
}
to {
top: 95vh;
background-color: darkcyan;
box-shadow: 5px 5px 25px #747474;
}
}
#headerImage {
width: 100vw;
height: 100vh;
overflow: hidden;
position: fixed;
padding: 0px;
margin: 0px;
z-index: -10000000;
}
#main-nav>li {
width: 9vw;
height: 7vh;
color: #ffffff;
float: right;
text-align: center;
line-height: 7vh;
margin: 0px;
font-size: medium;
z-index: 100;
list-style-type: none;
transition: 0.25s;
}
#main-nav {
background-color: rgba(245, 255, 249, 0.5);
width: 50%;
height: 7vh;
position: fixed;
z-index: 100;
float: right;
transition: all 0.25s;
}
/*
#main-nav:hover {
background-color: rgba(0,129,129,1);
} */
#main-nav>li:hover {
background-color: rgb(232, 255, 92);
}
#wall {
background-color: #d2d2d2;
width: 50%;
height: 100vh;
z-index: -10;
}
* {
margin: 0px;
padding: 0px;
}
#main-nav>li>a {
color: #000;
text-decoration: none;
}
.modalLayout {
opacity: 0;
}
.modalLayout:target {
position: fixed;
background-color: rgba(0, 0, 0, 0.5);
width: 100vw;
height: 100vh;
opacity: 1;
transition: all 0.4s;
z-index: 200;
}
.modal {
text-align: center;
padding: 6% 1% 1.7% 1%;
width: 30vw;
height: 20vh;
margin: 30vh 35vw;
background-color: crimson;
position: fixed;
transition: all 0.4s;
z-index: 10;
border-radius: 10px;
box-shadow: 2px 2px #484848;
}
.closeBtn {
font-size: 35px;
position: absolute;
top: 25vh;
right: 33vw;
float: right;
color: #fff;
font-weight: bold;
text-decoration: none;
z-index: 1000;
cursor: pointer;
margin-right: 5px;
transition: all 0.4s;
}
.mainPageButton>div {
display: none;
}
.mainPageButton:hover>div {
display: block;
transition: all 0.25s;
}
.mainPageButton>div>div {
width: 15vw;
height: 8vh;
background-color: #d2d2d2;
color: #000;
font-size: medium;
float: top;
border-bottom: black 1px solid;
list-style-type: none;
position: relative;
line-height: 8vh;
}
.mainPageButton>div>div>a {
text-decoration: none;
color: #fff;
font-size: medium;
text-align: center;
list-style-type: none;
background-color: #d2d2d2;
padding-right: 2px;
}
.mainMenu {
position: absolute;
top: 88vh;
z-index: 0;
margin-right: 1vw;
}
.mainMenu>div {
width: 15vw;
height: 10vh;
border-bottom: black solid 2px;
margin-bottom: 3vh;
background-color: white;
transition: all .3s;
text-align: center;
line-height: 10vh;
}
.mainMenu>div:hover {
width: 17vw;
height: 12vh;
background-color: #ffcfce;
}
.mainMenu>div>a {
font-size: x-large;
color: #000;
cursor: pointer;
text-decoration: none;
}
.about {
width: 20vw;
height: 40vh;
background-color: #94ffca;
border-radius: 5px;
position: absolute;
top: 88vh;
left: 0;
float: left;
font-size: larger;
padding: 1vw;
transition: all 0.3s;
margin-left: 4px;
overflow: auto;
}
.about:hover {
transform: translate(5px);
background-color: rgba(148, 255, 202, 0.5);
}
#modalcontainer {
background-color: rgba(256, 256, 256, 0.75);
top: 80vh;
position: absolute;
width: 100%;
height: 200%;
z-index: -10;
border-top-left-radius: 50px;
border-top-right-radius: 50px;
}
#modalswall {
width: 50vw;
height: 150vh;
background-color: #0d213c;
position: absolute;
top: 85vh;
right: 20vw;
z-index: -5;
border-radius: 8px;
box-shadow: 20px 20px 25px grey;
filter: opacity(90%);
}
.bodyModals {
background-color: #acd7ff;
top: 90vh;
width: 35vw;
height: 25vh;
right: 28vw;
position: relative;
z-index: 5;
border-radius: 10px;
transition: all .5s;
margin-bottom: 10vh;
}
.bodyModals:hover {
-webkit-animation: modalAnimation;
-webkit-animation-duration: 3s;
-webkit-animation-direction: alternate;
-webkit-animation-iteration-count: infinite;
}
.bodyModals>p {
padding: 1vw;
font-size: large;
}
#wrapper {
margin-bottom: 170vh;
position: relative;
}
#footer {
position: relative;
width: 50vw;
min-height: 25vh;
bottom: 0;
background-color: #0d213c;
}
#footer>p {
font-size: large;
text-align: center;
color: #fff;
padding: 10px 0px;
}
html,
body {
height: 100%;
margin: 0;
padding: 0;
}
<ul id="main-nav">
<li class="mainPageButton">
<div>
<div>
</div>
<div>
</div>
<div>
</div>
<div>
</div>
</div>
</li>
<li>
</li>
<li>
</li>
</ul>
<img src="http://ghmahdi.ir/wp-content/uploads/header.jpg" id="headerImage">
<div id="wrapper">
<div id="aboutMe" class="modalLayout">
<div>
×
</div>
<div class="modal"></div>
</div>
<div id="contactUS" class="modalLayout">
<div>
×
</div>
<div class="modal"></div>
</div>
<div class="mainMenu">
<div> </div>
<div></div>
<div></div>
<div></div>
</div>
<div class="about"></div>
<div id="modalswall"></div>
<div class="bodyModals"> </div>
<div class="bodyModals"></div>
<div class="bodyModals"></div>
<div id="modalcontainer"> </div>
</div>
<div id="footer">
</div>
For interest, also see:
Bug 133271
viewport units in case of 'overflow:auto'

How can I align my menu icon and header text

On my site, there is a menu hamburger icon and a title. I've been trying to align them so they on the same row, but I can't figure out how. I've tried wrapping inside a div and I've also tried display:inline-block. Does anybody know how to align the text and hamburger icon.
#import url(http://fonts.googleapis.com/css?family=Raleway:500);
*,
*:before,
*:after {
box-sizing: border-box;
}
.menu-wrapper {
position: relative;
width: 250px;
height: 250px;
margin-top: 60px;
margin-left: 30px;
}
.menu {
position: relative;
width: 36px;
height: 6px;
background-color: #707070;
user-select: none;
transition: all 0.25s ease-in-out;
cursor: pointer;
margin: 5px;
color: #707070;
-webkit-perspective: 1000;
-webkit-backface-visibility: hidden;
-webkit-transform: translate3d(0, 0, 0);
-webkit-tap-highlight-color: transparent;
}
.menu label {
cursor: pointer;
position: absolute;
font-family: 'Raleway', sans-serif;
font-size: 40px;
line-height: 30px;
top: -12px;
left: 48px;
}
.menu:hover > ul.nav-links,
.menu.open > ul.nav-links {
transition: all 0.25s ease-in-out;
opacity: 1;
width: 180px;
transform: translateX(15px);
pointer-events: auto;
}
.menu:after,
.menu:before {
content: "";
position: absolute;
width: 36px;
height: 6px;
background-color: #707070;
transition: all 0.25s ease-in-out;
}
.menu:after {
top: 12px;
}
.menu:before {
top: -12px;
}
.menu:hover,
.menu.open {
background-color: transparent;
}
.menu:hover::after,
.menu:hover::before,
.menu.open::after,
.menu.open::before {
transition: all 0.3s ease-in-out;
width: 18px;
}
.menu:hover::after,
.menu.open::after {
transform: translate(3px, -7px) rotate(405deg);
}
.menu:hover::before,
.menu.open::before {
transform: translate(12px, 17px) rotate(-405deg);
}
.menu ul.nav-links {
margin: 0;
padding: 36px 0 0 0;
opacity: 0;
transform: translateX(-15px);
transition: all 0.25s ease-in-out;
position: absolute;
width: 0;
height: 0;
pointer-events: none;
}
.menu ul.nav-links li {
width: 100%;
padding: 4px 8px;
list-style-type: none;
font-family: 'Raleway', sans-serif;
font-size: 25px;
text-transform: uppercase;
transition: all 0.25s ease-in-out;
border-left: 2px solid #707070;
}
.menu ul.nav-links li:hover,
.menu ul.nav-links li.active {
color: #707070;
border-left: 2px solid #707070;
}
#import url('https://fonts.googleapis.com/css?family=Fjalla+One');
#import url('https://fonts.googleapis.com/css?family=Roboto');
#import url('https://fonts.googleapis.com/css?family=Oswald');
#import url('https://fonts.googleapis.com/css?family=Quicksand');
header {
background: #fff;
height: 145px;
position: fixed;
top: 0;
transition: top 0.2s ease-in-out;
width: 100%;
border-bottom: 5px solid;
border-bottom-color: #bcbcbc;
}
.nav-up {
top: -145px;
}
body,
html {
margin: 0;
padding: 0;
}
video.home {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
overflow: hidden;
z-index: -100;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
div.vid {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
overflow: hidden;
z-index: -100;
}
footer {
background: #222020;
height: 50px;
position: fixed;
bottom: 0;
margin-bottom: 0.5em;
margin-bottom: 0.5em;
margin-left: 0.5em;
margin-right: 0.5em;
width: 99%;
}
p.copyright {
color: white;
text-transform: uppercase;
font-size: 15px;
font-family: 'Roboto', sans-serif;
}
div.footer {
float: left;
margin-left: 2em;
}
h1 {
text-align: center;
font-family: 'Fjalla One', sans-serif;
color: #666;
}
p {
color: black;
font-family: 'Oswald', sans-serif;
}
a.contact {
text-decoration: none;
color: white;
background-color: #36a2dc;
padding: 20px;
padding-left: 10px;
border-radius: 5%;
cursor: pointer;
outline: none;
height: 100px;
width: 200px;
font-family: 'Quicksand', sans-serif;
}
i.icon {
padding: 8px;
}
div.contact {
position: absolute;
left: 50%;
transform: translate(-50%, -50%);
}
ul.social {
display: block;
margin: 5% 0;
list-style-type: none;
text-align: center;
margin-top: 0px;
}
ul.social li {
font-size: 1em;
display: inline;
padding: 0 2%;
}
ul.social li a {
color: #707070;
}
ul.social li.dribble a:hover {
color: #e040a9;
}
ul.social li.twitter a:hover {
color: #258fc9;
}
ul.social li.behance a:hover {
color: #212121;
}
ul.social li.googleplus a:hover {
color: #e73710;
}
ul.social li.github a:hover {
color: #171515;
}
/*=================HEADER=====================================*/
a {
text-decoration: none;
color: #707070;
}
a:hover {
color: #898e8e;
}
a:active {
color: white;
}
div.head {
margin-top: 10px;
}
/*=========================================================== */
.container {
max-width: 960px;
margin: 0 auto;
}
/* ============================================================
SECTIONS
============================================================ */
section.module:last-child {
margin-bottom: 0;
}
section.module h2 {
margin-bottom: 40px;
font-family: 'Fjalla One', sans-serif;
font-size: 30px;
color: #515151;
text-align: center;
}
section.module p {
margin-bottom: 40px;
font-size: 16px;
font-weight: 300;
color: #515151;
text-align: center;
}
section.module p:last-child {
margin-bottom: 0;
}
section.module.content {
padding: 40px 0;
}
section.module.parallax {
height: 600px;
background-position: 50% 50%;
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
}
section.module.parallax h1 {
color: rgba(255, 255, 255, 0.8);
font-size: 48px;
line-height: 600px;
font-weight: 700;
text-align: center;
text-transform: uppercase;
text-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}
section.module.parallax-1 {
background-image: url("https://static.pexels.com/photos/34578/pexels-photo.jpg");
}
section.module.parallax-2 {
background-image: url("https://d2lm6fxwu08ot6.cloudfront.net/img-thumbs/960w/UQ9AB8NRV9.jpg");
}
section.module.parallax-3 {
background-image: url("https://d2lm6fxwu08ot6.cloudfront.net/img-thumbs/960w/2UXCQG5Q7W.jpg");
}
#media all and (min-width: 600px) {
section.module h2 {
font-size: 42px;
}
section.module p {
font-size: 20px;
}
section.module.parallax h1 {
font-size: 96px;
}
}
#media all and (min-width: 960px) {
section.module.parallax h1 {
font-size: 160px;
}
}
<header class="nav-down">
<!-- Open on hover menú -->
<div class="menu-wrapper">
<div class="menu">
<ul class="nav-links">
<li>Home
</li>
<li>About
</li>
<li>Portfolio
</li>
<li class="active">Projects
</li>
<li>Contact
</li>
</ul>
</div>
</div>
<div class="">
<h1>William Chen</h1>
<ul class="social">
<li class="dribble"><i class="fa fa-dribbble fa-3x"></i>
</li>
<li class="twitter"><i class="fa fa-twitter fa-3x"></i>
</li>
<li class="behance"><i class="fa fa-behance fa-3x"></i>
</li>
<li class="googleplus"><i class="fa fa-google-plus fa-3x"></i>
</li>
<li class="github"><i class="fa fa-github fa-3x"></i>
</li>
</ul>
</div>
</header>
Here is a JsFiddle with some changes: https://jsfiddle.net/m5b2f0gc/1/
One thing I did is changed the .menu margin, and then I created a new ID called "william" to help move the margin left.
.menu {
position: relative;
width: 36px;
height: 6px;
background-color: #707070;
user-select: none;
transition: all 0.25s ease-in-out;
cursor: pointer;
margin: 20px;
color: #707070;
-webkit-perspective: 1000;
-webkit-backface-visibility: hidden;
-webkit-transform: translate3d(0, 0, 0);
-webkit-tap-highlight-color: transparent;
}
#william {
margin-left: 150px;
}
Lots of comments here...but none of them are suggesting the seemingly easiest option.
Wrap both of the elements in question in a div (or not, it works without parent div so long as your widths for both menu-wrapper and head are <= 100% combined).
Add the following both the .menu-wrapper and the .head class:
.menu-wrapper, .head {
float:left;
}
That will get them on the same row. Then you can use padding/line heights to get them aligned more beautifully.
I think this code does what you want:
#import url(http://fonts.googleapis.com/css?family=Raleway:500);
*,
*:before,
*:after {
box-sizing: border-box;
}
.menu-wrapper {
position: relative;
width: 250px;
height: 250px;
margin-top: 60px;
margin-left: 30px;
text-align: justify;
}
.menu {
position: relative;
width: 36px;
height: 6px;
background-color: #707070;
user-select: none;
transition: all 0.25s ease-in-out;
cursor: pointer;
margin: 5px;
color: #707070;
-webkit-perspective: 1000;
-webkit-backface-visibility: hidden;
-webkit-transform: translate3d(0, 0, 0);
-webkit-tap-highlight-color: transparent;
}
.menu label {
cursor: pointer;
position: absolute;
font-family: 'Raleway', sans-serif;
font-size: 40px;
line-height: 30px;
top: -12px;
left: 48px;
}
.menu:hover > ul.nav-links,
.menu.open > ul.nav-links {
transition: all 0.25s ease-in-out;
opacity: 1;
width: 180px;
transform: translateX(15px);
pointer-events: auto;
}
.menu:after,
.menu:before {
content: "";
position: absolute;
width: 36px;
height: 6px;
background-color: #707070;
transition: all 0.25s ease-in-out;
}
.menu:after {
top: 12px;
}
.menu:before {
top: -12px;
}
.menu:hover,
.menu.open {
background-color: transparent;
}
.menu:hover::after,
.menu:hover::before,
.menu.open::after,
.menu.open::before {
transition: all 0.3s ease-in-out;
width: 18px;
}
.menu:hover::after,
.menu.open::after {
transform: translate(3px, -7px) rotate(405deg);
}
.menu:hover::before,
.menu.open::before {
transform: translate(12px, 17px) rotate(-405deg);
}
.menu ul.nav-links {
margin: 0;
padding: 36px 0 0 0;
opacity: 0;
transform: translateX(-15px);
transition: all 0.25s ease-in-out;
position: absolute;
width: 0;
height: 0;
pointer-events: none;
}
.menu ul.nav-links li {
width: 100%;
padding: 4px 8px;
list-style-type: none;
font-family: 'Raleway', sans-serif;
font-size: 25px;
text-transform: uppercase;
transition: all 0.25s ease-in-out;
border-left: 2px solid #707070;
}
.menu ul.nav-links li:hover,
.menu ul.nav-links li.active {
color: #707070;
border-left: 2px solid #707070;
}
#import url('https://fonts.googleapis.com/css?family=Fjalla+One');
#import url('https://fonts.googleapis.com/css?family=Roboto');
#import url('https://fonts.googleapis.com/css?family=Oswald');
#import url('https://fonts.googleapis.com/css?family=Quicksand');
header {
background: #fff;
height: 145px;
position: fixed;
top: 0;
transition: top 0.2s ease-in-out;
width: 100%;
border-bottom: 5px solid;
border-bottom-color: #bcbcbc;
}
.nav-up {
top: -145px;
}
body,
html {
margin: 0;
padding: 0;
}
video.home {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
overflow: hidden;
z-index: -100;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
div.vid {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
overflow: hidden;
z-index: -100;
}
footer {
background: #222020;
height: 50px;
position: fixed;
bottom: 0;
margin-bottom: 0.5em;
margin-bottom: 0.5em;
margin-left: 0.5em;
margin-right: 0.5em;
width: 99%;
}
p.copyright {
color: white;
text-transform: uppercase;
font-size: 15px;
font-family: 'Roboto', sans-serif;
}
div.footer {
float: left;
margin-left: 2em;
}
h1 {
text-align: center;
font-family: 'Fjalla One', sans-serif;
color: #666;
margin-bottom: -80px;
}
p {
color: black;
font-family: 'Oswald', sans-serif;
}
a.contact {
text-decoration: none;
color: white;
background-color: #36a2dc;
padding: 20px;
padding-left: 10px;
border-radius: 5%;
cursor: pointer;
outline: none;
height: 100px;
width: 200px;
font-family: 'Quicksand', sans-serif;
}
i.icon {
padding: 8px;
}
div.contact {
position: absolute;
left: 50%;
transform: translate(-50%, -50%);
}
ul.social {
display: block;
margin: 5% 0;
list-style-type: none;
text-align: center;
margin-top: 0px;
}
ul.social li {
font-size: 1em;
display: inline;
padding: 0 2%;
}
ul.social li a {
color: #707070;
}
ul.social li.dribble a:hover {
color: #e040a9;
}
ul.social li.twitter a:hover {
color: #258fc9;
}
ul.social li.behance a:hover {
color: #212121;
}
ul.social li.googleplus a:hover {
color: #e73710;
}
ul.social li.github a:hover {
color: #171515;
}
/*=================HEADER=====================================*/
a {
text-decoration: none;
color: #707070;
}
a:hover {
color: #898e8e;
}
a:active {
color: white;
}
div.head {
margin-top: 10px;
}
/*=========================================================== */
.container {
max-width: 960px;
margin: 0 auto;
}
/* ============================================================
SECTIONS
============================================================ */
section.module:last-child {
margin-bottom: 0;
}
section.module h2 {
margin-bottom: 40px;
font-family: 'Fjalla One', sans-serif;
font-size: 30px;
color: #515151;
text-align: center;
}
section.module p {
margin-bottom: 40px;
font-size: 16px;
font-weight: 300;
color: #515151;
text-align: center;
}
section.module p:last-child {
margin-bottom: 0;
}
section.module.content {
padding: 40px 0;
}
section.module.parallax {
height: 600px;
background-position: 50% 50%;
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
}
section.module.parallax h1 {
color: rgba(255, 255, 255, 0.8);
font-size: 48px;
line-height: 600px;
font-weight: 700;
text-align: center;
text-transform: uppercase;
text-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}
section.module.parallax-1 {
background-image: url("https://static.pexels.com/photos/34578/pexels-photo.jpg");
}
section.module.parallax-2 {
background-image: url("https://d2lm6fxwu08ot6.cloudfront.net/img-thumbs/960w/UQ9AB8NRV9.jpg");
}
section.module.parallax-3 {
background-image: url("https://d2lm6fxwu08ot6.cloudfront.net/img-thumbs/960w/2UXCQG5Q7W.jpg");
}
#media all and (min-width: 600px) {
section.module h2 {
font-size: 42px;
}
section.module p {
font-size: 20px;
}
section.module.parallax h1 {
font-size: 96px;
}
}
#media all and (min-width: 960px) {
section.module.parallax h1 {
font-size: 160px;
}
}
<h1>William Chen</h1>
<div class="menu-wrapper">
<div class="menu">
<ul class="nav-links">
<li>Home
</li>
<li>About
</li>
<li>Portfolio
</li>
<li class="active">Projects
</li>
<li>Contact
</li>
</ul>
</div>
</div>
<div class="head">
<ul class="social">
<li class="dribble"><i class="fa fa-dribbble fa-3x"></i>
</li>
<li class="twitter"><i class="fa fa-twitter fa-3x"></i>
</li>
<li class="behance"><i class="fa fa-behance fa-3x"></i>
</li>
<li class="googleplus"><i class="fa fa-google-plus fa-3x"></i>
</li>
<li class="github"><i class="fa fa-github fa-3x"></i>
</li>
</ul>
</div>
JSFiddle: https://jsfiddle.net/wvyxe5rp/2/
What I did is move the h1 element on top and then add this line:
margin-bottom: -80px;
inside the css of h1.