Layout html cards and search bar - html

HELLOOOO amazing stackoverflow community <3
I am having trouble setting out listings (as cards), next to the menu bar. This is the layout i would like. Any help is greatly appreciated !!! <3 The listings also change daily and have multiple pages
body {
font-family:Quicksand;
font-weight:700;
}
.menu_bar{
text-align: left;
padding-left: 20px;
width: 10%;
}
ul.form {
position:relative;
background:#fff;
width:250px;
margin:auto;
padding:0;
list-style: none;
overflow:hidden;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
-webkit-box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.1);
-moz-box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.1);
box-shadow: 1px 1px 10px rgba(0, 0, 0, 0.1);
}
.form li a {
width:225px;
padding-left:20px;
height:50px;
line-height:50px;
display:block;
overflow:hidden;
position:relative;
text-decoration:none;
text-transform:uppercase;
font-size:14px;
color:#686868;
-webkit-transition:all 0.2s linear;
-moz-transition:all 0.2s linear;
-o-transition:all 0.2s linear;
transition:all 0.2s linear;
}
.form li a:hover {
background:#efefef;
}
.form li a.profile {
border-left:5px solid #008747;
}
.form li a.messages {
border-left:5px solid #fecf54;
}
.form li a.settings {
border-left:5px solid #cf2130;
}
.form li a.logout {
border-left:5px solid #dde2d5;
}
.form li:first-child a:hover, .form li:first-child a {
-webkit-border-radius: 5px 5px 0 0;
-moz-border-radius: 5px 5px 0 0;
border-radius: 5px 5px 0 0;
}
.form li:last-child a:hover, .form li:last-child a {
-webkit-border-radius: 0 0 5px 5px;
-moz-border-radius: 0 0 5px 5px;
border-radius: 0 0 5px 5px;
}
.form li a:hover i {
color:#ea4f35;
}
.form i {
margin-right:15px;
-webkit-transition:all 0.2s linear;
-moz-transition:all 0.2s linear;
-o-transition:all 0.2s linear;
transition:all 0.2s linear;
}
.form em {
font-size: 10px;
background: #ea4f35;
padding: 3px 5px;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
font-style: normal;
color: #fff;
margin-top: 17px;
margin-right: 15px;
line-height: 10px;
height: 10px;
float:right;
}
.form li.selected a {
background:#efefef;
}
h1 {
color:red;
margin:0 auto;
margin-top:60px;
margin-bottom:40px;
font-size:30px;
width:300px;
text-align:center;
}
p {
text-align:center;
position:absolute;
width:100%;
bottom:0;
font-size:12px;
font-family:Arial, Helvetica;
color:#fff;
text-transform:uppercase;
}
p a {
color:#fff;
text-decoration:none;
}
.row-center {
text-align: center;
}
.main_row {
max-width: 4900px;
margin: 50px auto 0;
}
.third_row {
max-width: 4900px;
margin: 50px auto 0;
}
.card {
padding: 0 1.7rem;
width: 100%;
}
.card2 {
float: left;
padding: 0 1.7rem;
width: 50%;
}
.card .menu-content {
margin: 0;
padding: 0;
list-style-type: none;
}
.card .menu-content::before,
.card .menu-content::after {
content: '';
display: table;
}
.card .menu-content::after {
clear: both;
}
.card .menu-content li {
display: inline-block;
}
.card .menu-content a {
color: #fff;
}
.card .menu-content span {
position: absolute;
left: 50%;
top: 0;
font-size: 10px;
font-weight: 700;
font-family: 'Open Sans';
transform: translate(-50%, 0);
}
.card .wrapper {
background-color: #fff;
min-height: 540px;
position: relative;
overflow: hidden;
box-shadow: 0 19px 38px rgba(0, 0, 0, 0.3), 0 15px 12px rgba(0, 0, 0, 0.2);
}
.card .wrapper:hover .data {
transform: translateY(0);
}
.card .data {
position: absolute;
bottom: 0;
width: 100%;
transform: translateY(calc(70px + 1em));
transition: transform 0.3s;
}
.card .data .content {
padding: 1em;
position: relative;
z-index: 1;
}
.card .author {
font-size: 12px;
}
.card .title {
margin-top: 10px;
}
.card .text {
height: 70px;
margin: 0;
}
.card input[type='checkbox'] {
display: none;
}
.card input[type='checkbox']:checked + .menu-content {
transform: translateY(-60px);
}
.example-2 .wrapper {
background: url(https://theluxurytravelexpert.files.wordpress.com/2014/01/scenery.jpg) center/cover no-repeat;
}
.example-2 .wrapper:hover .menu-content span {
transform: translate(-50%, -10px);
opacity: 1;
}
.example-2 .header {
color: #fff;
padding: 1em;
}
.example-2 .header::before,
.example-2 .header::after {
content: '';
display: table;
}
.example-2 .header::after {
clear: both;
}
.example-2 .header .date {
float: left;
font-size: 12px;
}
.example-2 .menu-content {
float: right;
}
.example-2 .menu-content li {
margin: 0 5px;
position: relative;
}
.example-2 .menu-content span {
transition: all 0.3s;
opacity: 0;
}
.example-2 .data {
color: #fff;
transform: translateY(calc(70px + 4em));
}
.example-2 .title a {
color: #fff;
}
.example-2 .button {
display: block;
width: 100px;
margin: 2em auto 1em;
text-align: center;
font-size: 12px;
color: #fff;
line-height: 1;
position: relative;
font-weight: 700;
}
.example-2 .button::after {
content: '\2192';
opacity: 0;
position: absolute;
right: 0;
top: 50%;
transform: translate(0, -50%);
transition: all 0.3s;
}
.example-2 .button:hover::after {
transform: translate(5px,-50%);
opacity: 1;
}
.card_sub_article {
display: inline-block;
height: 10%;
width: 40%;
}
.card_main .menu-content {
margin: 0;
padding: 0;
list-style-type: none;
}
.card_main .menu-content::before,
.card .menu-content::after {
content: '';
display: table;
}
.card_main .menu-content::after {
clear: both;
}
.card_main .menu-content li {
display: inline-block;
}
.card_main .menu-content a {
color: #fff;
}
.card_main .menu-content span {
position: absolute;
left: 50%;
top: 0;
font-size: 10px;
font-weight: 700;
font-family: 'Open Sans';
transform: translate(-50%, 0);
}
.card_main .wrapper {
background-color: #fff;
min-height: 540px;
position: relative;
overflow: hidden;
box-shadow: 0 19px 38px rgba(0, 0, 0, 0.3), 0 15px 12px rgba(0, 0, 0, 0.2);
}
.card_main .wrapper:hover .data {
transform: translateY(0);
}
.card_main .data {
position: absolute;
bottom: 0;
width: 100%;
transform: translateY(calc(70px + 1em));
transition: transform 0.3s;
}
.card_main .data .content {
padding: 1em;
position: relative;
z-index: 1;
}
.card_main .author {
font-size: 12px;
}
.card_main .title {
margin-top: 10px;
}
.card_main .text {
height: 70px;
margin: 0;
}
.card_main input[type='checkbox'] {
display: none;
}
.card_main input[type='checkbox']:checked + .menu-content {
transform: translateY(-60px);
}
<!DOCTYPE html>
<html>
<head>
<title>Vertical Menu</title>
<link href='http://fonts.googleapis.com/css?family=Quicksand:400,700' rel='stylesheet' type='text/css' />
<script type="text/javascript" src="http://code.jquery.com/jquery-2.0.0.min.js" /></script>
<link rel="stylesheet" type="text/css" href="style.css">
<link href="http://netdna.bootstrapcdn.com/font-awesome/3.1.1/css/font-awesome.min.css" rel="stylesheet" />
<!--[if IE 7]>
<link href="http://netdna.bootstrapcdn.com/font-awesome/3.1.1/css/font-awesome-ie7.min.css" rel="stylesheet" />
<![endif]-->
</head>
<body>
<div class="menu_bar">
<h1> Menu</h1>
<ul class="form">
<li><a class="profile" href="#"><i class="icon-user"></i>My Profile</a></li>
<li class="selected"><a class="messages" href="#"><i class="icon-envelope-alt"></i>Messages <em>5</em></a></li>
<li><a class="stats" href="#"><i class="icon-cog"></i>Statistics</a></li>
<li><a class="settings" href="#"><i class="icon-cog"></i>Settings</a></li>
<li><a class="logout" href="#"><i class="icon-signout"></i>Logout</a></li>
</ul>
<h1>Listings:</h1>
<div class="card_sub_article">
<div class="example-2 card_main">
<div class="wrapper">
<div class="header">
<div class="date">
<span class="day">12</span>
<span class="month">Aug</span>
<span class="year">2016</span>
</div>
<ul class="menu-content">
<li>
</li>
<li><span>18</span></li>
<li><span>3</span></li>
</ul>
</div>
<div class="data">
<div class="content">
<span class="author">REVIEW</span>
<h1 class="title">TITLE</h1>
<p class="text">Description</p>
Read more
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

When dealing with layouts like this, the best solution is to use a frontend framework, such as Bootstrap. You can start using it right away by adding this in your head:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
Afterwards, you can use the grid layout, which is very useful if you also want to make your website responsive. You should read the documentation to familiarize yourself with the whole capabilities of Bootstrap, but your HTML should ideally look something like this with it:
<body>
<div class="container-fluid">
<div class="row">
<div class="col-md-2">
<div class="menu_bar">
<h1> Menu</h1>
<ul class="form">
<li><a class="profile" href="#"><i class="icon-user"></i>My Profile</a></li>
<li class="selected"><a class="messages" href="#"><i class="icon-envelope-alt"></i>Messages <em>5</em></a></li>
<li><a class="stats" href="#"><i class="icon-cog"></i>Statistics</a></li>
<li><a class="settings" href="#"><i class="icon-cog"></i>Settings</a></li>
<li><a class="logout" href="#"><i class="icon-signout"></i>Logout</a></li>
</ul>
</div>
</div>
<div class="col-md-10">
<div class="listings">
<h1>Listings:</h1>
<div class="row">
<div class="col-md-3">
<div class="card_sub_article">
<div class="example-2 card_main">
<div class="wrapper">
<div class="header">
<div class="date">
<span class="day">12</span>
<span class="month">Aug</span>
<span class="year">2016</span>
</div>
<ul class="menu-content">
<li>
</li>
<li><span>18</span></li>
<li><span>3</span></li>
</ul>
</div>
<div class="data">
<div class="content">
<span class="author">REVIEW</span>
<h1 class="title">TITLE</h1>
<p class="text">Description</p>
Read more
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
It will look wonky at first but remove the css styles for .card_sub_article and it should look fine.
Also a minor error in your HTML syntax: you closed script tag twice, which is fine most of the time, but not good practice.
Hope this helps you get started :)

Related

Create a responsive burger menu

I've made a lot of progress on my site, but the problem is that my burger menu doesn't show up, does anyone have an idea what's causing this please?
I tried different things, debugging and so on but I can't make it appear again -_-
So if anyone knows why, and has explanations I'm a taker I'm completely lost I know what to do lol
And then if you have other constructive criticism on my code of course I'm a taker thank you in advance for giving me your time
$('.m-nav-toggle').click(function(e) {
e.preventDefault();
$('.m-right').toggleClass('is-open');
$('m-nav-toggle').toggleClass('is-open');
})
#import url('https://fonts.googleapis.com/css2?family=Lato:ital,wght#0,100;0,300;0,400;0,900;1,700&display=swap');
#import url('https://fonts.googleapis.com/css2?family=Roboto:wght#900&display=swap');
.menu {
background: #757de8;
width: 100%;
height: 66px;
line-height: 66px;
box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22);
}
.m-left {
float: left;
}
.logo {
margin: 0;
padding: 0;
}
.m-right {
float: right;
}
.m-links {
text-decoration: none;
color: #fff;
text-transform: uppercase;
font-weight: 700;
padding: 0;
margin: 0 15px;
font-family: 'Lato', sans-serif;
transition: all 0.3s ease-in-out;
border-bottom: 2px solid transparent;
padding-bottom: 3px;
}
.m-links:hover {
border-color: #fff;
}
.m-links i {
margin-right: 5px;
}
.m-nav-toggle {
width: 40px;
height: 66px;
display: none;
align-items: center;
float: right;
cursor: pointer;
}
span.m-nav-toggle-icon,
span.m-toggle-icon:before,
span.m-toggle-icon:after {
content: "";
display: block;
width: 100%;
height: 3px;
background: #fff;
position: relative;
transition: all 0.3s ease-in-out;
}
span.m-toggle-icon:before {
top: 12px;
}
span.m-toggle-icon:after {
top: -14px;
}
.m-right.is-open {
transform: translateX(0);
}
.m-nav-toggle.is-open span.m-toggle-icon {
background: transparent;
}
.m-nav-toggle.is-open span.m-toggle-icon:before, .m-nav-toggle.is-open span.m-toggle-icon:after {
transform-origin: center;
transform: rotate(45deg);
top: 0;
}
#media only screen and (max-width: 950px) {
.m-right {
position: absolute;
top: 66px;
right: 0;
width: 200px;
height: 100%;
background: #757de8;
transform: translateX(100%);
transition: all 0.3s ease-in-out;
}
.m-links {
display: block;
text-align: center;
padding: 0;
margin: 0 20px;
height: 55px;
}
.m-nav-toggle.is-open span.m-toggle-icon:before {
transform: rotate(-45deg);
}
.m-nav-toggle {
display: flex;
}
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"
integrity="sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
></script>
<script src="https://kit.fontawesome.com/8b1b202200.js" crossorigin="anonymous"></script>
<header role="header">
<nav class="menu" role="navigation">
<div class="inner">
<img class="fit-picture" src="img/logo.svga">
<div class="m-left"></div>
<div class="m-right">
<i class="fas fa-home"></i> Home
<i class="fas fa-book"></i> Documentation
<i class="fas fa-comments"></i> Feedback
<i class="fas fa-handshake"></i> Partners
<i class="fas fa-envelope"></i> Contact
</div>
<div class="m-nav-toggle">
<span class="m-toggle-icon"></span>
</div>
</div>
</nav>
</header>
File : normalize.css :
html,
body {
margin: 0;
padding: 0;
overflow-x: hidden;
}
.inner {
width: 80%;
margin: auto;
}
enter code here
The "m-toggle-icon" class needs "width:100%" and it will be shown. This is because its parent has "display: flex".
Working example:
$('.m-nav-toggle').click(function(e) {
e.preventDefault();
$('.m-right').toggleClass('is-open');
$('m-nav-toggle').toggleClass('is-open');
})
#import url('https://fonts.googleapis.com/css2?family=Lato:ital,wght#0,100;0,300;0,400;0,900;1,700&display=swap');
#import url('https://fonts.googleapis.com/css2?family=Roboto:wght#900&display=swap');
.menu {
background: #757de8;
width: 100%;
height: 66px;
line-height: 66px;
box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22);
}
.m-left {
float: left;
}
.logo {
margin: 0;
padding: 0;
}
.m-right {
float: right;
}
.m-links {
text-decoration: none;
color: #fff;
text-transform: uppercase;
font-weight: 700;
padding: 0;
margin: 0 15px;
font-family: 'Lato', sans-serif;
transition: all 0.3s ease-in-out;
border-bottom: 2px solid transparent;
padding-bottom: 3px;
}
.m-links:hover {
border-color: #fff;
}
.m-links i {
margin-right: 5px;
}
.m-nav-toggle {
width: 40px;
height: 66px;
display: none;
align-items: center;
float: right;
cursor: pointer;
}
span.m-nav-toggle-icon,
span.m-toggle-icon:before,
span.m-toggle-icon:after {
content: "";
display: block;
width: 100%;
height: 3px;
background: #fff;
position: relative;
transition: all 0.3s ease-in-out;
}
span.m-toggle-icon:before {
top: 12px;
}
span.m-toggle-icon:after {
top: -14px;
}
.m-right.is-open {
transform: translateX(0);
}
.m-nav-toggle.is-open span.m-toggle-icon {
background: transparent;
}
.m-nav-toggle.is-open span.m-toggle-icon:before, .m-nav-toggle.is-open span.m-toggle-icon:after {
transform-origin: center;
transform: rotate(45deg);
top: 0;
}
#media only screen and (max-width: 950px) {
.m-right {
position: absolute;
top: 66px;
right: 0;
width: 200px;
height: 100%;
background: #757de8;
transform: translateX(100%);
transition: all 0.3s ease-in-out;
}
.m-links {
display: block;
text-align: center;
padding: 0;
margin: 0 20px;
height: 55px;
}
.m-nav-toggle.is-open span.m-toggle-icon:before {
transform: rotate(-45deg);
}
.m-nav-toggle {
display: flex;
}
}
.m-toggle-icon {
width: 100%;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"
integrity="sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
></script>
<script src="https://kit.fontawesome.com/8b1b202200.js" crossorigin="anonymous"></script>
<header role="header">
<nav class="menu" role="navigation">
<div class="inner">
<img class="fit-picture" src="img/logo.svga">
<div class="m-left"></div>
<div class="m-right">
<i class="fas fa-home"></i> Home
<i class="fas fa-book"></i> Documentation
<i class="fas fa-comments"></i> Feedback
<i class="fas fa-handshake"></i> Partners
<i class="fas fa-envelope"></i> Contact
</div>
<div class="m-nav-toggle">
<span class="m-toggle-icon"></span>
</div>
</div>
</nav>
</header>

How to align the menu to the right side of the desktop?

I am have a menu for my website and which is currently align on the left side of the browser. I am try to align on the right side of the browser.
here is the demo: here
what I want is just put the hole menu and align it on the right side of the browser screen. currently its showing on the left side.
trying to do:https://i.stack.imgur.com/D0y00.png
html code:
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/3.0.3/normalize.css">
<link href='https://fonts.googleapis.com/css?family=Montserrat' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
<header>
<span class="toggle-button">
<div class="menu-bar menu-bar-top"></div>
<div class="menu-bar menu-bar-middle"></div>
<div class="menu-bar menu-bar-bottom"></div>
</span>
<div class="menu-wrap">
<div class="menu-sidebar">
<ul class="menu">
<li>Home</li>
<li class="children">News
<span class="arrow"></span>
<ul class="child-menu ">
<li>Link 1</li>
<li>Link 2</li>
<li>link 3</li>
</ul>
</li>
<li class="children">Contact
<span class="arrow"></span>
<ul class="child-menu ">
<li>Link 1</li>
<li>Link 2</li>
<li>link 3</li>
</ul>
</li>
<li class="children">About
<span class="arrow"></span>
<ul class="child-menu ">
<li>Link 1</li>
<li>Link 2</li>
<li>link 3</li>
</ul>
</li>
<li>FAQ</li>
<li>Services</li>
</ul>
</div>
</div>
</header>
<div class="wrapper" style="background-color:;padding:15px;">
<section class="text" style="background-color:;">
<h2 class="heading" id="headings" style="background-color:;text-align:center;">Three Line Menu & CSS Transitions</h2>
<p class="buttons" style="min-width: 200px;margin:auto;background-color:;text-align:center;">
Learn More
</p>
</section>
</div>
CSS:
html {
background: url(https://s33.postimg.cc/tm1vd9yy7/Background_2.jpg);
background-attachment:fixed;
background-repeat: no-repeat;
background-size: cover;
}
.btn_one {
text-decoration: none;
color: white;
font-weight: 100;
border: 1px #fbbc05 solid;
padding: 1em 3em;
border-radius: 100px;
}
a {
text-decoration: none;
}
ul {
padding-left: 0;
}
li {
list-style: none;
}
* {
box-sizing: border-box;
}
body {
font-family: 'Montserrat', Arial, serif;
}
::selection {
background-color: #EBEBF2;
color: #83828D;
}
/* ==================================== */
/* Navigaton Menu */
/* ==================================== */
.menu-wrap {
background-color: #625871;
position: fixed;
top: 0;
height: 100%;
width: 280px;
margin-left: -280px;
font-size: 1em;
font-weight: 700;
overflow: auto;
transition: .25s;
z-index: 10;
}
.menu-show {
margin-left: 0;
box-shadow: 4px 2px 15px 1px #262424;
}
.menu-sidebar {
margin: 75px 0 80px 10px;
position: relative;
top: 70px;
}
.menu-sidebar li {
padding: 18px 22px 0;
}
.menu-sidebar li > a {
color: #f3f3f3;
font-size: 1.18em;
position: relative;
}
.menu-sidebar li > a::after {
content: "";
display: block;
height: 0.15em;
position: absolute;
top: 100%;
width: 100%;
left: 50%;
transform: translate(-50%);
background-image: linear-gradient(to right, transparent 50.3%, #FFFA3B 50.3%);
transition: background-position .2s .1s ease-out;
background-size: 200% auto;
}
.menu-sidebar li > a:hover::after {
background-position: -100% 0;
}
.menu-sidebar .children {
position: relative;
}
.menu-sidebar .children .child-menu {
display: none;
}
.arrow::after {
content: "\f107";
font-family: 'FontAwesome';
padding: 10px;
color: #FFFA3B;
position: relative;
}
.arrow:hover::after {
cursor: pointer;
color: #fff;
}
.arrow:active::after {
top: 2px;
}
/*Hamburger Button*/
.toggle-button {
position: fixed;
width: 44px;
height: 40px;
top: 50px;
left: 40px;
padding: 4px;
transition: .25s;
z-index: 15;
}
.toggle-button:hover {
cursor: pointer;
}
.toggle-button .menu-bar {
position: absolute;
border-radius: 2px;
transition: .5s;
}
.toggle-button .menu-bar-top {
border: 4px solid #fff;
border-bottom: none;
top: 0;
width: 80%;
}
.toggle-button .menu-bar-middle {
height: 4px;
background-color: #fff;
margin-top: 7px;
margin-bottom: 7px;
width: 40%;
top: 4px;
}
.toggle-button .menu-bar-bottom {
border: 4px solid #fff;
border-top: none;
top: 22px;
width: 60%;
}
.toggle-button:hover div
{
width: 80%;
}
.button-open {
left: 25px;
}
.button-open .menu-bar-top {
border-color: #fff;
transform: rotate(45deg) translate(8px, 8px);
transition: .5s;
}
.button-open .menu-bar-middle {
background-color: #fff;
transform: translate(230px);
transition: .1s ease-in;
opacity: 0;
}
.button-open .menu-bar-bottom {
border-color: #fff;
transform: rotate(-45deg) translate(7px, -7px);
transition: .5s;
}
/* Text Block */
.wrapper {
width: 40%;
margin: 100px auto 0;
color: #83828D;
}
.wrapper .text {
padding: 30px;
}
.wrapper .text .heading {
margin-bottom: 40px;
font-size: 2em;
color:#fff;
}
.wrapper .text p {
line-height: 1.6em;
}
.wrapper .text .buttons {
margin-top: 40px;
}
/* Buttons */
.wrapper .buttons .button {
display: inline-block;
margin-right: 20px;
padding: 20px 25px;
border-radius: 2em;
background-color: #70CE64;
color: #fff;
font-size: .9em;
font-weight: 700;
transition: background-color .3s;
}
.wrapper .buttons .button-secondary {
background-color: #FF6746;
}
.wrapper .buttons .button-primary:hover {
background-color: #84D07A;
}
.wrapper .buttons .button-secondary:hover {
background-color: #FF7D60;
}
/*Active state for the buttons*/
.wrapper .buttons .button-primary:active {
background-color: #70CE64;
}
.wrapper .buttons .button-secondary:active {
background-color: #FF6746;
}
/*Icons*/
.wrapper .buttons .button span {
position: relative;
display: inline-block;
padding-right: 20px;
}
.wrapper .buttons .button span::after {
position: absolute;
font-family: "FontAwesome";
right: -3px;
font-size: 14px;
top: 0;
transition: top .3s, right .3s;
}
.wrapper .buttons .button-primary span::after {
content: "\f019";
}
.wrapper .buttons .button-secondary span::after {
content: "\f178";
}
/*Slight icons animation*/
.wrapper .buttons .button-primary:hover span::after {
top: 4px;
}
.wrapper .buttons .button-secondary:hover span::after {
right: -6px;
}
#media screen and (max-width: 480px) {
#headings{
margin-bottom:20px;
font-size: 18px;
color:#fff;
}
.btn_one {
text-decoration: none;
color: #fff;
font-size:12px;
font-weight: 100;
border: 1px #fbbc05 solid;
padding: 8px 23px;
border-radius: 100px;
}
ul {
padding-left: 35px;
}
.menu-sidebar li
{
padding:0;
}
.menu-wrap {
width: 200px;
}
}
SCRIPT:
$(document).ready(function() {
var $toggleButton = $('.toggle-button'),
$menuWrap = $('.menu-wrap'),
$sidebarArrow = $('.arrow');
// Hamburger button
$toggleButton.on('click', function() {
$(this).toggleClass('button-open');
$menuWrap.toggleClass('menu-show');
});
// Sidebar navigation arrows
$sidebarArrow.click(function() {
$(this).next().slideToggle(300);
});
});
Here is the source code for reference: https://nofile.io/f/9bKHsuOoUza/source_code_new.zip
Can anybody guide me? Any input is appreciated.
Thank you so much.
change the toggle button to:
default:
.toggle-button {
position: fixed;
width: 44px;
height: 40px;
top: 50px;
left: auto;
padding: 4px;
transition: .25s;
z-index: 15;
right: 40px;
}
open:
.button-open {
left: auto;
right: 25px;
}
then change the menu to:
closed:
.menu-wrap {
background-color: #00000030;
position: fixed;
top: 0;
height: 100%;
width: 240px;
margin-left: 0;
right: -280px;
font-size: 1em;
font-weight: 700;
overflow: auto;
transition: .25s;
z-index: 10;
left: auto;
}
open:
.menu-show {
left: auto;
right: 0;
margin-left: 0;
box-shadow: 4px 2px 15px 1px #080707;
}
easy as that!

Dropdown animation when I remove mouse

I've coded an animation for my navbar, which shows the log in form when hovered, but when I remove the mouse from it, it just disappears, I would like it to smoothly go away the same way it came, what do I have to add to the code?
HTML
<!DOCTYPE html>
<html>
<head>
<title>¡Servicios en un Chasquido! | Chasquido Servicios</title>
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="css/style.css">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
<script src="js/jquery.js"></script>
<script src="js/bootstrap.js"></script>
<script defer src="js/fontawesome-all.js"></script>
</head>
<body>
<header>
<div class="container">
<img src="img1.png" style="max-width: 80px; margin-top: 0px;" alt="logo" class="logo">
<nav>
<ul class="menu">
<li class="home">INICIO</li>
<li class="with-arrow">CONTACTO</li>
<li class="with-arrow">REGISTRATE</li>
<li class="with-arrow">INGRESAR
<div class="login-box">
<h2>Datos</h2>
<form>
<p>CORREO</p>
<input type="text" name="" placeholder="Escribir e-mail">
<p>CONTRASEÑA</p>
<input type="password" name="" placeholder="Escribir Contraseña">
<input type="submit" name="" value="Listo">
¿Contraseña olvidada?
</form>
</div>
</li>
</ul>
</nav>
</header>
</div>
<div id="carousel1" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#carousel1" data-slide-to="0" class="1"></li>
<li data-target="#carousel1" data-slide-to="1"></li>
<li data-target="#carousel1" data-slide-to="2"></li>
<li data-target="#carousel1" data-slide-to="3"></li>
<li data-target="#carousel1" data-slide-to="4"></li>
<li data-target="#carousel1" data-slide-to="5"></li>
<li data-target="#carousel1" data-slide-to="6"></li>
</ol>
<div class="carousel-inner">
<div class="item active">
<img src="images/portada1.png" width="1900px">
</div>
<div class="item">
<img src="images/portada2.png" width="1900px">
</div>
<div class="item">
<img src="images/portada3.png" width="1900px">
</div>
<div class="item">
<img src="images/portada4.png" width="1900px">
</div>
<div class="item">
<img src="images/portada5.png" width="1900px">
</div>
<div class="item">
<img src="images/portada6.png" width="1900px">
</div>
<div class="item">
<img src="images/portada7.png" width="1900px">
</div>
</div>
<a href="#carousel1" class="left carousel-control" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true">
</span>
</a>
<a href="#carousel1" class="right carousel-control" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true">
</span>
</a>
</div>
</div>
</div>
</body>
</html>
CSS:
.main-wrapper{
margin: 0 auto;
width: 95%;
min-width: 900px;
}
body{
margin: 0;
background: #222;
font-family: sans-serif;
}
.container{
width: 80%;
margin: 0 auto;
}
header{
background: #151515 ;
}
.logo{
float: left;
padding: 10px 0;
}
nav{
float: right;
}
nav ul{
margin: 0;
padding: 0;
list-style: none;
position: relative;
z-index:1000;
}
nav li{
display: inline-block;
margin-left: 50px;
padding: 40px;
position: relative;
}
nav a{
color: lightgrey;
}
nav a:hover {
color: white;
text-decoration: none;
}
body{
margin: 0;
padding: 0;
background: white;
}
.menu {
display: flex;
list-style: none;
background-color: #151515;
margin-left: 50px;
}
.menu li.with-arrow {
padding: 35px 50px;
cursor: pointer;
padding-bottom: 20px;
position: relative;
margin: 5px;
color: lightgray;
font-family: sans-serif;
margin-left: 50px;
}
.menu li.with-arrow:after {
font-family: FontAwesome;
font-size: 20px;
content: '\f107';
display: inline-block;
color: yellow;
position: absolute;
bottom: 0;
left: 50%;
transform: translate(-50%, 0);
transition: transform 0.3s ease;
}
.menu li.with-arrow:hover {
background-color: rgba(0, 0, 0, 0.25);
}
.menu li.with-arrow:hover:after {
transform: translate(-50%, 5px);
}
.menu li {
padding: 35px 15px;
padding-bottom: 20px;
position: relative;
margin: 5px;
color: lightgray;
font-family: sans-serif;
cursor: pointer;
}
.menu li:before{
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 3px;
background: white;
overflow: hidden;
z-index: -1;
transform: scaleX(0);
transform-origin: right;
transition: .15s;
}
.menu li:hover:before{
transform: scaleX(1);
transform-origin: left;
}
.menu li.home:after{
content: '';
position: absolute;
bottom: 0;
right: 0;
width: 100%;
height: 3px;
background: white;
overflow: hidden;
z-index: -1;
transform: scaleX(0);
transform-origin: left;
transition: .15s;
}
.menu li.home:hover:after{
transform: scaleX(1);
transform-origin: right;
}
.menu li:hover {
background-color: rgba(0, 0, 0, .25);
color: white;
}
.login-box{
width: 350px;
height: 420px;
padding: 80px 40px;
box-sizing: border-box;
background: rgba(0, 0, 0, .8);
position: absolute;
right: 0px;
top: 100%;
opacity: 0;
visibility: hidden;
cursor: auto;
}
.menu li:hover .login-box{
animation: load .3s forwards;
display: block;
visibility: visible;
}
#keyframes load{
0%{
transform: translateX(25px) scale(1.6);
}
100%{
opacity: 1;
transform: translateX(0px);
}
}
h2 {
margin: 0;
padding: 0px;
color: #efed40;
text-align: center;
}
.login-box p
{
margin: 0;
padding: 0;
color: white;
}
.login-box input
{
width: 100%;
margin-bottom: 20px;
}
.login-box input[type="text"],
.login-box input[type="password"]
{
border: none;
border-bottom: 1px solid #fff;
background: transparent;
outline: none;
height: 40px;
color: white;
font-size: 16px;
}
::placeholder
{
color: rgba(255, 255, 255, .3);
font-family: sans-serif;
font-weight: bold;
}
.login-box input[type="submit"]
{
border: none;
outline: none;
height: 40px;
color: #fff;
font-size: 16px;
background: #ff267e;
cursor: pointer;
border-radius: 20px;
}
.login-box input[type="submit"]:hover
{
background: #efed40;
color: #262626;
}
.login-box a
{
color: #fff;
font-size: 14px;
text-decoration: none;
}
.login-box a:hover
{
color: yellow;
}
This is my entire code if you would like to see it, if it looks unprofessional or something like that, please know that I'm new to all this and it'll take me some time, I'm still in the dark here, anyway, thanks!
You can't leave the </ul> outside of the tag you put the <ul> in. Your code is:
<nav>
<ul class="menu">
<li class="home">INICIO</li>
<li class="with-arrow">CONTACTO</li>
<li class="with-arrow">REGISTRATE</li>
<li class="with-arrow">INGRESAR
<div class="login-box">
<h2>Datos</h2>
<form>
<p>CORREO</p>
<input type="text" name="" placeholder="Escribir e-mail">
<p>CONTRASEÑA</p>
<input type="password" name="" placeholder="Escribir Contraseña">
<input type="submit" name="" value="Listo">
¿Contraseña olvidada?
</form>
</div>
</li>
</nav>
That's not valid, and it simply doesn't make any sense. It's like doing <nav><ul></nav></ul>
It should be:
<nav>
<ul class="menu">
<li class="home">INICIO</li>
<li class="with-arrow">CONTACTO</li>
<li class="with-arrow">REGISTRATE</li>
<li class="with-arrow">INGRESAR
<div class="login-box">
<h2>Datos</h2>
<form>
<p>CORREO</p>
<input type="text" name="" placeholder="Escribir e-mail">
<p>CONTRASEÑA</p>
<input type="password" name="" placeholder="Escribir Contraseña">
<input type="submit" name="" value="Listo">
¿Contraseña olvidada?
</form>
</div>
</li>
</ul>
</nav>
For this simple animation you dont need the keyframes. This animation can easily create with transition. If you want to have the animation with keyframes you need to work with javascript and so you can handle the classes from li when entering and leaving the element with the mouse. You can then give various animations to the different classes
.menu li .login-box {
transform: translateX(25px) scale(1.6);
opacity: 0;
transition: .3s all linear;
}
.menu li:hover .login-box {
display: block;
visibility: visible;
opacity: 1;
transform: translateX(0px);
}
And here is the result with your Codesample:
.main-wrapper {
margin: 0 auto;
width: 95%;
min-width: 900px;
}
body {
margin: 0;
background: #222;
font-family: sans-serif;
}
.container {
width: 80%;
margin: 0 auto;
}
header {
background: #151515;
}
.logo {
float: left;
padding: 10px 0;
}
nav {
float: right;
}
nav ul {
margin: 0;
padding: 0;
list-style: none;
position: relative;
z-index: 1000;
}
nav li {
display: inline-block;
margin-left: 50px;
padding: 40px;
position: relative;
}
nav a {
color: lightgrey;
}
nav a:hover {
color: white;
text-decoration: none;
}
body {
margin: 0;
padding: 0;
background: white;
}
.menu {
display: flex;
list-style: none;
background-color: #151515;
margin-left: 50px;
}
.menu li.with-arrow {
padding: 35px 50px;
cursor: pointer;
padding-bottom: 20px;
position: relative;
margin: 5px;
color: lightgray;
font-family: sans-serif;
margin-left: 50px;
}
.menu li.with-arrow:after {
font-family: FontAwesome;
font-size: 20px;
content: '\f107';
display: inline-block;
color: yellow;
position: absolute;
bottom: 0;
left: 50%;
transform: translate(-50%, 0);
transition: transform 0.3s ease;
}
.menu li.with-arrow:hover {
background-color: rgba(0, 0, 0, 0.25);
}
.menu li.with-arrow:hover:after {
transform: translate(-50%, 5px);
}
.menu li {
padding: 35px 15px;
padding-bottom: 20px;
position: relative;
margin: 5px;
color: lightgray;
font-family: sans-serif;
cursor: pointer;
}
.menu li:before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 3px;
background: white;
overflow: hidden;
z-index: -1;
transform: scaleX(0);
transform-origin: right;
transition: .15s;
}
.menu li:hover:before {
transform: scaleX(1);
transform-origin: left;
}
.menu li.home:after {
content: '';
position: absolute;
bottom: 0;
right: 0;
width: 100%;
height: 3px;
background: white;
overflow: hidden;
z-index: -1;
transform: scaleX(0);
transform-origin: left;
transition: .15s;
}
.menu li.home:hover:after {
transform: scaleX(1);
transform-origin: right;
}
.menu li:hover {
background-color: rgba(0, 0, 0, .25);
color: white;
}
.login-box {
width: 350px;
height: 420px;
padding: 80px 40px;
box-sizing: border-box;
background: rgba(0, 0, 0, .8);
position: absolute;
right: 0px;
top: 100%;
opacity: 0;
visibility: hidden;
cursor: auto;
}
.menu li .login-box {
transform: translateX(25px) scale(1.6);
opacity: 0;
transition: .3s all linear;
}
.menu li:hover .login-box {
display: block;
visibility: visible;
opacity: 1;
transform: translateX(0px);
}
h2 {
margin: 0;
padding: 0px;
color: #efed40;
text-align: center;
}
.login-box p {
margin: 0;
padding: 0;
color: white;
}
.login-box input {
width: 100%;
margin-bottom: 20px;
}
.login-box input[type="text"],
.login-box input[type="password"] {
border: none;
border-bottom: 1px solid #fff;
background: transparent;
outline: none;
height: 40px;
color: white;
font-size: 16px;
}
::placeholder {
color: rgba(255, 255, 255, .3);
font-family: sans-serif;
font-weight: bold;
}
.login-box input[type="submit"] {
border: none;
outline: none;
height: 40px;
color: #fff;
font-size: 16px;
background: #ff267e;
cursor: pointer;
border-radius: 20px;
}
.login-box input[type="submit"]:hover {
background: #efed40;
color: #262626;
}
.login-box a {
color: #fff;
font-size: 14px;
text-decoration: none;
}
.login-box a:hover {
color: yellow;
}
<!DOCTYPE html>
<html>
<head>
<title>¡Servicios en un Chasquido! | Chasquido Servicios</title>
<link rel="stylesheet" href="css/bootstrap.css">
<link rel="stylesheet" href="css/style.css">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
<script src="js/jquery.js"></script>
<script src="js/bootstrap.js"></script>
<script defer src="js/fontawesome-all.js"></script>
</head>
<body>
<header>
<div class="container">
<img src="img1.png" style="max-width: 80px; margin-top: 0px;" alt="logo" class="logo">
<nav>
<ul class="menu">
<li class="home">INICIO</li>
<li class="with-arrow">CONTACTO</li>
<li class="with-arrow">REGISTRATE</li>
<li class="with-arrow">INGRESAR
<div class="login-box">
<h2>Datos</h2>
<form>
<p>CORREO</p>
<input type="text" name="" placeholder="Escribir e-mail">
<p>CONTRASEÑA</p>
<input type="password" name="" placeholder="Escribir Contraseña">
<input type="submit" name="" value="Listo">
¿Contraseña olvidada?
</form>
</div>
</li>
</ul>
</nav>
</div>
</header>
</body>
</html>
The js Result: jsfidde

Need help centering text and overlapping with background color

I'm having trouble centering my home page text (the tag). I'm not sure why it's not working.
I have a button that performs a short animation when the user hovers over the button. The button is supposed to fill with red but when I change the background color of the #main container, the button loses its animation. I'm assuming that it's getting hidden behind main's background color but I don't know how to resolve this issue.
Thanks!
/*CSS DOCUMENT*/
/* Notes:
Hashtags are for ID's and dots(.) are for classes
If you do #nav .selected for example, it would look for .selected within the nav ID.
*/
/*Import stuff for button animations */
#import url(https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css);
#import url(https://fonts.googleapis.com/css?family=Lato:300,400,700);
/*Global Button Syles*/
a.animated-button:link, a.animated-button:visited {
position: relative;
display: block;
margin: 30px auto 0;
padding: 14px 15px;
color: #fff;
font-size:14px;
font-weight: bold;
text-align: center;
text-decoration: none;
text-transform: uppercase;
overflow: hidden;
letter-spacing: .08em;
border-radius: 0;
text-shadow: 0 0 1px rgba(0, 0, 0, 0.2), 0 1px 0 rgba(0, 0, 0, 0.2);
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-o-transition: all 1s ease;
transition: all 1s ease;
}
a.animated-button:link:after, a.animated-button:visited:after {
content: "";
position: absolute;
height: 0%;
left: 50%;
top: 50%;
width: 150%;
z-index: -1;
-webkit-transition: all 0.75s ease 0s;
-moz-transition: all 0.75s ease 0s;
-o-transition: all 0.75s ease 0s;
transition: all 0.75s ease 0s;
}
a.animated-button:link:hover, a.animated-button:visited:hover {
color: #FFF;
text-shadow: none;
}
a.animated-button:link:hover:after, a.animated-button:visited:hover:after {
height: 450%;
}
a.animated-button:link, a.animated-button:visited {
position: relative;
display: block;
margin: 30px auto 0;
padding: 14px 15px;
color: #fff;
font-size:14px;
border-radius: 0;
font-weight: bold;
text-align: center;
text-decoration: none;
text-transform: uppercase;
overflow: hidden;
letter-spacing: .08em;
text-shadow: 0 0 1px rgba(0, 0, 0, 0.2), 0 1px 0 rgba(0, 0, 0, 0.2);
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-o-transition: all 1s ease;
transition: all 1s ease;
}
/*End Global Button Styles*/
/*Victoria Button Style 3*/
a.animated-button.victoria-three {
border: 2px solid #D24D57;
color: #333;
}
a.animated-button.victoria-three:after {
background: #D24D57;
opacity: .5;
-moz-transform: translateX(-50%) translateY(-50%);
-ms-transform: translateX(-50%) translateY(-50%);
-webkit-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
}
a.animated-button.victoria-three:hover:after {
height: 140%;
opacity: 1;
}
body{
background-color: #EEEEEE;
font-family: 'Montserrat', sans-serif;
}
a{
text-decoration: none;
color: #D24D57;
}
h1{
padding: 10px;
align: left;
}
.light_saber{
align:bottom;
margin:5px;
}
h2{
align:center;
}
#container{
width: auto;
margin-left: 0px;
margin-right: auto;
}
#header{
background-color: #D24D57;
color: white;
padding: 10px;
}
#content{
padding: 10px 10px 10px 10px; /*top right bottom left*/
width: auto;
}
#nav{
width: auto;
height: auto;
background-color: #999;
}
#nav ul{
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
}
#nav li {
float: left;
}
#nav li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover {
background-color: #111;
}
#nav .selected{
font-weight: bold;
}
#main{
width: auto;
height: 2000px;
float: center;
background-color: #999;
}
#main .profile_picture{
border-radius: 20px;
width: 250px;
height: 350px;
padding: 10px;
float: right;
background-color: #333;
}
#footer{
clear: both; /*Lets get past all the floating elements and then display footer*/
padding: 10px;
background-color: #999;
color: white;
text-align: center;
}
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Siman Shrestha</title>
<link href = "stylesheet.css" rel="stylesheet" type="text/css" />
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css">
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
</head>
<body>
<div id="container">
<div id="header">
<h1>Siman Shrestha</h1>
<div class="light_saber">
<img src="light_saber.gif" alt="Whoops, something went wrong :-(">
</div>
</div>
<div id="content">
<div id="nav">
<ul>
<li><a class="selected" href=""> Home </a></li> <!--creates a class tag and hyperlink*/-->
<li><a class="selected" href=""> About </a></li>
<li><a class="selected" href=""> Contact </a></li>
</ul>
</div>
<div id="main">
<h2>Home Page</h2>
<img src="IMG_1689.jpg" class="profile_picture" alt="Whoops, something went wrong :-(">
<!--Resume Button-->
<div class="col-md-3 col-sm-3 col-xs-6">
Resume
</div>
<p>
Saucin'
</P>
</div>
</div>
<div id="footer">
Copyright © 2017 Siman Shrestha
</div>
</div>
</body>
</html>
Changing the z-index works
/*CSS DOCUMENT*/
/* Notes:
Hashtags are for ID's and dots(.) are for classes
If you do #nav .selected for example, it would look for .selected within the nav ID.
*/
/*Import stuff for button animations */
#import url(https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css);
#import url(https://fonts.googleapis.com/css?family=Lato:300,400,700);
/*Global Button Syles*/
a.animated-button:link, a.animated-button:visited {
position: relative;
display: block;
margin: 30px auto 0;
padding: 14px 15px;
color: #fff;
font-size:14px;
font-weight: bold;
text-align: center;
text-decoration: none;
text-transform: uppercase;
overflow: hidden;
letter-spacing: .08em;
border-radius: 0;
text-shadow: 0 0 1px rgba(0, 0, 0, 0.2), 0 1px 0 rgba(0, 0, 0, 0.2);
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-o-transition: all 1s ease;
transition: all 1s ease;
}
a.animated-button:link:after, a.animated-button:visited:after {
content: "";
position: absolute;
height: 0%;
left: 50%;
top: 50%;
width: 150%;
z-index: -1;
-webkit-transition: all 0.75s ease 0s;
-moz-transition: all 0.75s ease 0s;
-o-transition: all 0.75s ease 0s;
transition: all 0.75s ease 0s;
}
a.animated-button:link:hover, a.animated-button:visited:hover {
color: #FFF;
text-shadow: none;
}
a.animated-button:link:hover:after, a.animated-button:visited:hover:after {
height: 450%;
}
a.animated-button:link, a.animated-button:visited {
position: relative;
display: block;
margin: 30px auto 0;
padding: 14px 15px;
color: #fff;
font-size:14px;
border-radius: 0;
font-weight: bold;
text-align: center;
text-decoration: none;
text-transform: uppercase;
overflow: hidden;
letter-spacing: .08em;
text-shadow: 0 0 1px rgba(0, 0, 0, 0.2), 0 1px 0 rgba(0, 0, 0, 0.2);
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-o-transition: all 1s ease;
transition: all 1s ease;
}
/*End Global Button Styles*/
/*Victoria Button Style 3*/
a.animated-button.victoria-three {
border: 2px solid #D24D57;
color: #333;
z-index:998;
}
a.animated-button.victoria-three span{
z-index:999;
}
a.animated-button.victoria-three:after {
background: #D24D57;
opacity: .5;
-moz-transform: translateX(-50%) translateY(-50%);
-ms-transform: translateX(-50%) translateY(-50%);
-webkit-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
}
a.animated-button.victoria-three:hover:after {
height: 140%;
opacity: 1;
}
body{
background-color: #EEEEEE;
font-family: 'Montserrat', sans-serif;
}
a{
text-decoration: none;
color: #D24D57;
}
h1{
padding: 10px;
align: left;
}
.light_saber{
align:bottom;
margin:5px;
}
h2{
align:center;
}
#container{
width: auto;
margin-left: 0px;
margin-right: auto;
}
#header{
background-color: #D24D57;
color: white;
padding: 10px;
}
#content{
padding: 10px 10px 10px 10px; /*top right bottom left*/
width: auto;
}
#nav{
width: auto;
height: auto;
background-color: #999;
}
#nav ul{
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
}
#nav li {
float: left;
}
#nav li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover {
background-color: #111;
}
#nav .selected{
font-weight: bold;
}
#main{
width: auto;
height: 2000px;
float: center;
background-color: #999;
}
#main .profile_picture{
border-radius: 20px;
width: 250px;
height: 350px;
padding: 10px;
float: right;
background-color: #333;
}
#footer{
clear: both; /*Lets get past all the floating elements and then display footer*/
padding: 10px;
background-color: #999;
color: white;
text-align: center;
}
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Siman Shrestha</title>
<link href = "stylesheet.css" rel="stylesheet" type="text/css" />
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css">
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
</head>
<body>
<div id="container">
<div id="header">
<h1>Siman Shrestha</h1>
<div class="light_saber">
<img src="light_saber.gif" alt="Whoops, something went wrong :-(">
</div>
</div>
<div id="content">
<div id="nav">
<ul>
<li><a class="selected" href=""> Home </a></li> <!--creates a class tag and hyperlink*/-->
<li><a class="selected" href=""> About </a></li>
<li><a class="selected" href=""> Contact </a></li>
</ul>
</div>
<div id="main">
<h2>Home Page</h2>
<img src="IMG_1689.jpg" class="profile_picture" alt="Whoops, something went wrong :-(">
<!--Resume Button-->
<div class="col-md-3 col-sm-3 col-xs-6">
<span>Resume</span>
</div>
<p>
Saucin'
</P>
</div>
</div>
<div id="footer">
Copyright © 2017 Siman Shrestha
</div>
</div>
</body>
</html>

Transform transition not working on responsive nav menu

I have a nav menu I made and I can't get the transform transition to work when I close the menu it only works when I open it. Here is my html
header#main {
position: fixed;
width: 100%;
z-index: 10;
box-shadow: 4px 1px 5px 1px rgba(0,0,0,0.75);
}
.container {
width: 95%;
margin: 0 auto;
}
header {
background: #FFFFFF;
padding: 1em 0 !important;
position: relative;
}
header::after {
content: '';
clear: both;
display: block;
}
.logo-container {
float: left;
margin-left:1em;
}
.site-nav {
position: absolute;
top: 2.3em;
right: 0;
}
.site-nav--open {
}
.site-nav ul {
padding: 0;
list-style: none;
}
.site-nav li {
border-bottom: none;
display:inline-block;
margin-left:3em;
}
.site-nav li:last-child {
border-bottom: none;
}
.site-nav a {
font-family:abel;
color: #333;
letter-spacing:2px;
padding:1.3em;
text-transform: uppercase;
text-decoration: none;
text-align:center;
}
a.login-nav {
color: white;
background: #ef7899;
padding-top: 2.4em !important;
padding-bottom: 2.25em !important;
padding-left: 2em !important;
padding-right: 2em!important ;
transition:background 0.5s ease-in-out;
}
a.login-nav:hover {
background:#000 !important;
color:white !important;
}
.site-nav a:hover,
.site-nav a:focus {
color: #333;
}
.site-nav--icon {
display: inline-block;
font-size: 1.5em;
margin-right: 1em;
width: 1.1em;
text-align: right;
color: rgba(255,255,255,.4);
}
.menu-toggle {
padding: 1em;
position: absolute;
top: 1.8em;
right: .7em;
cursor: pointer;
z-index:101;
display:none;
}
.hamburger,
.hamburger::before,
.hamburger::after {
content: '';
display: block;
background: #555;
height: 3px;
width: 1.75em;
border-radius: 3px;
transition: all ease-in-out 500ms;
}
.hamburger::before {
transform: translateY(-6px);
}
.hamburger::after {
transform: translateY(3px);
}
.open .hamburger {
transform: rotate(45deg);
background:black;
}
.open .hamburger::before {
opacity: 0;
}
.open .hamburger::after {
transform: translateY(-3px) rotate(-90deg);
background:black;
}
#media screen and (max-width: 1000px) {
.logo-container img {
width: 200px;
}
.menu-toggle {
display:block;
}
.site-nav {
position: absolute;
top: 100%;
right: 0%;
transform: translateX(100%);
transition:transform 0.8s ease;
}
.site-nav a{
display:none;
}
.site-nav li{
display:block;
}
.site-nav--open {
display: flex;
position: fixed;
top: 0;
right: 0;
z-index: 100;
transform: translateX(70%);
background: white;
height: 100%;
width: 100%;
transition:transform 0.8s ease;
}
.site-nav--open ul{
align-self:center;
}
.site-nav--open a {
font-family:abel;
color: #000;
display: inline-block;
letter-spacing:2px;
padding:1.3em;
text-transform: uppercase;
text-decoration: none;
text-align:center;
}
}
<header id="main">
<div class="container">
<div class="logo-container">
<h1>test</h1>
</div>
<nav class="site-nav">
<ul class="navi">
<li><span class="liner"><a class="vert" href="#one">Invest</a></span></li>
<li><span class="liner"><a class="vert" href="#two">Subscribe</a></span></li>
<li><span class="liner"><a class="vert" href="#why">Why Us</a></span></li>
<li><span class="liner"><a class="vert" href="#three">Faq</a></span></li>
<li class="log"><a class="login-nav" href="http://www.google.com"><i class="fa fa-sign-in" aria-hidden="true"></i>Login</a></li>
</ul>
</nav>
<div class="menu-toggle">
<div class="hamburger"></div>
</div>
</div>
</header>
I also have some jquery code, but all that does is toggle the menu and add a class when it's open so not sure if it's important to post it or not but here it is.
$('.menu-toggle').click(function() {
$('.site-nav').toggleClass('site-nav--open');
$(this).toggleClass('open');
$('.landing').toggleClass('landing-open');
})
Just replace css in .site-nav--open to .site-nav
$('.menu-toggle').click(function() {
$('.site-nav').toggleClass('site-nav--open');
$(this).toggleClass('open');
$('.landing').toggleClass('landing-open');
})
header#main {
position: fixed;
width: 100%;
z-index: 10;
box-shadow: 4px 1px 5px 1px rgba(0,0,0,0.75);
}
.container {
width: 95%;
margin: 0 auto;
}
header {
background: #FFFFFF;
padding: 1em 0 !important;
position: relative;
}
header::after {
content: '';
clear: both;
display: block;
}
.logo-container {
float: left;
margin-left:1em;
}
.site-nav {
position: absolute;
top: 2.3em;
right: 0;
}
.site-nav ul {
padding: 0;
list-style: none;
}
.site-nav li {
border-bottom: none;
display:inline-block;
margin-left:3em;
}
.site-nav li:last-child {
border-bottom: none;
}
.site-nav a {
font-family:abel;
color: #333;
letter-spacing:2px;
padding:1.3em;
text-transform: uppercase;
text-decoration: none;
text-align:center;
}
a.login-nav {
color: white;
background: #ef7899;
padding-top: 2.4em !important;
padding-bottom: 2.25em !important;
padding-left: 2em !important;
padding-right: 2em!important ;
transition:background 0.5s ease-in-out;
}
a.login-nav:hover {
background:#000 !important;
color:white !important;
}
.site-nav a:hover,
.site-nav a:focus {
color: #333;
}
.site-nav--icon {
display: inline-block;
font-size: 1.5em;
margin-right: 1em;
width: 1.1em;
text-align: right;
color: rgba(255,255,255,.4);
}
.menu-toggle {
padding: 1em;
position: absolute;
top: 1.8em;
right: .7em;
cursor: pointer;
z-index:101;
display:none;
}
.hamburger,
.hamburger::before,
.hamburger::after {
content: '';
display: block;
background: #555;
height: 3px;
width: 1.75em;
border-radius: 3px;
transition: all ease-in-out 500ms;
}
.hamburger::before {
transform: translateY(-6px);
}
.hamburger::after {
transform: translateY(3px);
}
.open .hamburger {
transform: rotate(45deg);
background:black;
}
.open .hamburger::before {
opacity: 0;
}
.open .hamburger::after {
transform: translateY(-3px) rotate(-90deg);
background:black;
}
#media screen and (max-width: 1000px) {
.logo-container img {
width: 200px;
}
.menu-toggle {
display:block;
}
.site-nav {
position: fixed;
top: 0%;
right: 0%;
transform: translateX(100%);
transition:transform 0.8s ease;
background: white;
height: 100%;
width: 310px;
z-index: 100;
}
.site-nav a{
display:none;
}
.site-nav li{
display:block;
}
.site-nav--open {
transform: translateX(0%);
}
.site-nav--open ul{
align-self:center;
}
.site-nav--open a {
font-family:abel;
color: #000;
display: inline-block;
letter-spacing:2px;
padding:1.3em;
text-transform: uppercase;
text-decoration: none;
text-align:center;
}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<header id="main">
<div class="container">
<div class="logo-container">
<h1>test</h1>
</div>
<nav class="site-nav">
<ul class="navi">
<li><span class="liner"><a class="vert" href="#one">Invest</a></span></li>
<li><span class="liner"><a class="vert" href="#two">Subscribe</a></span></li>
<li><span class="liner"><a class="vert" href="#why">Why Us</a></span></li>
<li><span class="liner"><a class="vert" href="#three">Faq</a></span></li>
<li class="log"><a class="login-nav" href="http://www.google.com"><i class="fa fa-sign-in" aria-hidden="true"></i>Login</a></li>
</ul>
</nav>
<div class="menu-toggle">
<div class="hamburger"></div>
</div>
</div>
</header>
Working Demo