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.
Related
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
I am trying to position "Kipplo.co.uk" so it is central like the button and it works but I'm wanting the design responsive, so when the window is resized it the heading will adjust to but instead its appearing into the navigation bar. I have also attempted to use relative but the button already uses the function.
What i'm looking for: I'm wanting the Heading and the button to be in the same place in the middle of the page that also responds to the screen size.
(See attached image below)
Kindest regards!
https://i.stack.imgur.com/MFMpA.png
https://i.stack.imgur.com/EjjuF.png
body {
background-color: rgb(10, 10, 10);
}
html, body {
max-width: 100%;
overflow-x: hidden;
}
/* Announcment bar */
.alert {
padding: 20px;
background-color: #2a7a85;
color: white;
}
.closebtn {
margin-left: 15px;
color: white;
font-weight: bold;
float: right;
font-size: 22px;
line-height: 20px;
cursor: pointer;
transition: 0.3s;
}
.closebtn:hover {
color: black;
}
body {margin: 0;}
/* Navigation bar */
ul.topnav {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: rgb(248, 248, 248);
}
ul.topnav li {float: left;}
ul.topnav li a {
display: block;
color: black;
text-align: center;
font-weight: bold;
padding: 25px 32px;
text-decoration: none;
}
ul.topnav li a:hover:not(.active) {background-color: rgb(55, 81, 165);}
ul.topnav li a.active {background-color: #0cc0d8;}
ul.topnav li.right {float: right;}
#media screen and (max-width: 600px) {
ul.topnav li.right,
ul.topnav li {float: none;}
}
/* Services Section on product page */
.services {
background: rgb(10, 10, 10);
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100vh;
}
.services h1 {
background-color: #77ff7e;
background-image: linear-gradient(
to right,
#00eeff 0%,
#0df1de 0%,
#0ad3f7 21%,
#2b86db 52%,
#23a6da 78%,
#06afda 100%
);
background-size: 100%;
-webkit-background-clip: text;
-moz-background-clip: text;
-webkit-text-fill-color: transparent;
-moz-text-fill-color: transparent;
margin-bottom: 5rem;
font-size: 2.5rem;
}
.services__container {
display: flex;
justify-content: center;
flex-wrap: wrap;
}
.services__card {
margin: 1rem;
height: 525px;
width: 400px;
border-radius: 4px;
background-image: linear-gradient(
to bottom,
rgba(0, 0, 0, 0) 0%,
rgba(17, 17, 17, 0.6) 100%
),
url('img/bus.PNG');
background-size: cover;
position: relative;
color: #fff;
}
.services__card:before {
opacity: 0.2;
}
.services__card:nth-child(2) {
background-image: linear-gradient(
to bottom,
rgba(0, 0, 0, 0) 0%,
rgba(17, 17, 17, 0.9) 100%
),
url('img/bus.PNG');
}
.services__card h2 {
position: absolute;
top: 350px;
left: 30px;
}
.services__card p {
position: absolute;
top: 400px;
left: 30px;
}
.services__card button {
color: #fff;
padding: 10px 20px;
border: none;
outline: none;
border-radius: 4px;
background: #19b6bb;
position: absolute;
top: 440px;
left: 30px;
font-size: 1rem;
}
.services__card button:hover {
cursor: pointer;
}
.services__card:hover {
transform: scale(1.075);
transition: 0.2s ease-in;
cursor: pointer;
}
#media screen and (max-width: 960px) {
.services {
height: 1600px;
}
.services h1 {
font-size: 2rem;
margin-top: 12rem;
}
}
#media screen and (max-width: 480px) {
.services {
height: 1400px;
}
.services h1 {
font-size: 1.2rem;
}
.services__card {
width: 300px;
}
}
/* On smaller screens, decrease text size */
#media only screen and (max-width: 300px) {
.text {font-size: 11px}
}
/* "not needed*/
.textcontainer2{
font-size: 2.5vh;
color: whitesmoke;
/* buttons */
}.main__btn {
font-size: 1rem;
background-image: linear-gradient(to top, #008cff 0%, #0e0bec 100%);
padding: 14px 32px;
border: none;
border-radius: 4px;
color: #fff;
cursor: pointer;
position: relative;
transition: all 0.35s;
outline: none;
bottom: -400px;
left: 50%;
margin-left: -100px;
top: 50%;
margin-top: -100px;
margin-bottom: 400px;
}
.main__btn a {
position: relative;
z-index: 2;
color: #fff;
text-decoration: none;
}
.main__btn:after {
position: absolute;
content: '';
top: 0;
left: 0;
width: 0;
height: 100%;
background: #4837ff;
transition: all 0.35s;
border-radius: 4px;
}
.main__btn:hover {
color: #fff;
}
.main__btn:hover:after {
width: 100%;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" href="img/icon.png">
<link rel="stylesheet" href="styles.css">
<style>
h1{
font-size: 60px;
margin:0;
padding:0;
text-align: center;
font-family: 'Courier New', Courier, monospace;
position:absolute ;
top: 50%;
left: 50%;
bottom: -80px;
margin-top: -50;
margin-left: -100;
margin-bottom: 80px;
transform: translate(-50%);
color: blue;
}
</style>
</head>
<body>
<div class="alert">
<span class="closebtn" onclick="this.parentElement.style.display='none';">×</span>
<center><strong>DEALS NOW ON!</strong> Upto 30% discounts this christmas
</div></center>
<ul class="topnav">
<li><img src="img/logo.png"></li>
<li><a class="active" href="index.html">Home</a></li>
<li>Products</li>
<li>Contact Us</li>
<li class="right">About Us</li>
</ul>
<h1> Kipplo.co.uk </h1>
<button class="main__btn">More Information</button>
</body>
</html>
you can use flex box to do that.
1.I wrapped all the elements in a div with class as container and added below properties
.container {
display: flex;
flex-direction: column;
height: 100vh;
}
2.wrapped button and the h1 tag in div with class btn-centering with properties
.btn-centering {
flex-grow: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
3.wrapped the h1 tag in a div with class text and property
.text {
width: 100%;
}
and removed all those position properties.
body {
background-color: rgb(10, 10, 10);
}
html,
body {
max-width: 100%;
overflow-x: hidden;
}
/* Announcment bar */
.alert {
padding: 20px;
background-color: #2a7a85;
color: white;
}
.closebtn {
margin-left: 15px;
color: white;
font-weight: bold;
float: right;
font-size: 22px;
line-height: 20px;
cursor: pointer;
transition: 0.3s;
}
.closebtn:hover {
color: black;
}
body {
margin: 0;
}
/* Navigation bar */
ul.topnav {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: rgb(248, 248, 248);
}
ul.topnav li {
float: left;
}
ul.topnav li a {
display: block;
color: black;
text-align: center;
font-weight: bold;
padding: 25px 32px;
text-decoration: none;
}
ul.topnav li a:hover:not(.active) {
background-color: rgb(55, 81, 165);
}
ul.topnav li a.active {
background-color: #0cc0d8;
}
ul.topnav li.right {
float: right;
}
#media screen and (max-width: 600px) {
ul.topnav li.right,
ul.topnav li {
float: none;
}
}
/* Services Section on product page */
.services {
background: rgb(10, 10, 10);
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100vh;
}
.services h1 {
background-color: #77ff7e;
background-image: linear-gradient(
to right,
#00eeff 0%,
#0df1de 0%,
#0ad3f7 21%,
#2b86db 52%,
#23a6da 78%,
#06afda 100%
);
background-size: 100%;
-webkit-text-fill-color: transparent;
-moz-text-fill-color: transparent;
margin-bottom: 5rem;
font-size: 2.5rem;
}
.services__container {
display: flex;
justify-content: center;
flex-wrap: wrap;
}
.services__card {
margin: 1rem;
height: 525px;
width: 400px;
border-radius: 4px;
background-image: linear-gradient(
to bottom,
rgba(0, 0, 0, 0) 0%,
rgba(17, 17, 17, 0.6) 100%
),
url('img/bus.PNG');
background-size: cover;
position: relative;
color: #fff;
}
.services__card:before {
opacity: 0.2;
}
.services__card:nth-child(2) {
background-image: linear-gradient(
to bottom,
rgba(0, 0, 0, 0) 0%,
rgba(17, 17, 17, 0.9) 100%
),
url('img/bus.PNG');
}
.services__card h2 {
position: absolute;
top: 350px;
left: 30px;
}
.services__card p {
position: absolute;
top: 400px;
left: 30px;
}
.services__card button {
color: #fff;
padding: 10px 20px;
border: none;
outline: none;
border-radius: 4px;
background: #19b6bb;
position: absolute;
top: 440px;
left: 30px;
font-size: 1rem;
}
.services__card button:hover {
cursor: pointer;
}
.services__card:hover {
transform: scale(1.075);
transition: 0.2s ease-in;
cursor: pointer;
}
#media screen and (max-width: 960px) {
.services {
height: 1600px;
}
.services h1 {
font-size: 2rem;
margin-top: 12rem;
}
}
#media screen and (max-width: 480px) {
.services {
height: 1400px;
}
.services h1 {
font-size: 1.2rem;
}
.services__card {
width: 300px;
}
}
/* On smaller screens, decrease text size */
#media only screen and (max-width: 300px) {
.text {
font-size: 11px;
}
}
/* "not needed*/
.textcontainer2 {
font-size: 2.5vh;
color: whitesmoke;
/* buttons */
}
.main__btn {
font-size: 1rem;
background-image: linear-gradient(to top, #008cff 0%, #0e0bec 100%);
padding: 14px 32px;
border: none;
border-radius: 4px;
color: #fff;
cursor: pointer;
transition: all 0.35s;
outline: none;
}
.main__btn a {
position: relative;
z-index: 2;
color: #fff;
text-decoration: none;
}
.main__btn:after {
position: absolute;
content: '';
top: 0;
left: 0;
width: 0;
height: 100%;
background: #4837ff;
transition: all 0.35s;
border-radius: 4px;
}
.main__btn:hover {
color: #fff;
}
.main__btn:hover:after {
width: 100%;
}
h1 {
font-size: 60px;
margin: 0;
padding: 0;
font-family: 'Courier New', Courier, monospace;
color: blue;
word-wrap: break-word;
text-align: center;
}
.container {
display: flex;
flex-direction: column;
height: 100vh;
}
.btn-centering {
flex-grow: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.text {
width: 100%;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" href="img/icon.png" />
<link rel="stylesheet" href="stack_overflow1.css" />
</head>
<body>
<div class="container">
<div class="alert">
<span
class="closebtn"
onclick="this.parentElement.style.display='none';"
>×</span
>
<center>
<strong>DEALS NOW ON!</strong> Upto 30% discounts this
christmas
</center>
</div>
<ul class="topnav">
<li><img src="img/logo.png" /></li>
<li><a class="active" href="index.html">Home</a></li>
<li>Products</li>
<li>Contact Us</li>
<li class="right">About Us</li>
</ul>
<div class="btn-centering">
<div class="text"><h1>Kipplo.co.uk</h1></div>
<button class="main__btn">
More Information
</button>
</div>
</div>
</body>
</html>
You can use
#media only screen and (min-height: 700px;) {
h1 {
bottom:10%;
}
}
This selects the h1 in a #media query for less than 600px height, and makes the h1 10% from the bottom, read more about media queries here; https://www.w3schools.com/cssref/css3_pr_mediaquery.asp
I created some background images in a div with slideshow and some content displaying on that, and now I'm trying to add a section right below my background image but anything I add after my background div in my html, locates behind my background image and top of my window as if I've had created no content in my webpage before this section except a navbar with sticky position. I put my codes here for better perception.
I'm trying to create content just after my background image as different, separated parts of my webpage, does anyone have an idea?
P.S: My main focus is running this web on full screen windows so please excuse my cluttered code result in non-full-screen windows.
*,
*::before,
*::after{
padding: 0;
margin: 0;
box-sizing: border-box;
}
body{
background-color: aqua;
}
header{
z-index: 999999999;
overflow: hidden;
position: sticky;
top: -31px;
}
header .header_main{
background-color: rgba(255,255,255,0.98);
}
header div.header_meta{
font-family: 'Open Sans', sans-serif;
font-weight: bold;
font-size: 11px;
border-bottom: 1px solid rgba(224, 224, 224, 0.56);
}
header div.container{
line-height: 30px;
width: 90%;
margin: auto;
padding: 0 50px;
}
header div.container nav ul{
line-height: 30px;
margin: 0 auto;
float: right;
}
header div.container nav ul li{
float: right;
list-style: none;
}
header div.container nav ul li a{
text-decoration: none;
float: right;
padding: 0 10px;
color: #ffffff;
}
header div.container nav ul li a:hover{
text-decoration: underline;
color: #E6E6E6;
}
header .header_meta .header_contact{
margin: auto;
line-height: 30px;
color: #ffffff;
}header .header_main{
box-shadow: 0 3px 4px -4px rgba(138, 138, 138, 0.65);
}
header .header_main .container_logo_nav{
width: 90%;
height: 60px;
line-height: 60px;
margin: 0 auto;
padding: 0 4%;
}
header .header_main .container_logo_nav img{
height: 100%;
width: 216px;
float: left;
}
header .header_main .container_logo_nav ul{
float: right;
padding-right: 1%;
}
header .header_main .container_logo_nav ul li{
float: right;
list-style: none;
}
header .header_main .container_logo_nav ul li a{
text-decoration: none;
font-family: 'Open Sans', sans-serif;
font-weight: bolder;
font-size: 14px;
color: #6E6E6E;
padding: 0 13px;
transition: 300ms;
}
header .header_main .container_logo_nav ul li a.search{
font-size: 11px;
}
header .header_main .container_logo_nav ul li a:hover{
color: #000000;
}
.container_slider{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 82vh;
animation: animate 35s ease-in-out infinite;
background-size: cover;
background: no-repeat center;
clear: both;
display: block;
}
.container_slider::before{
width: 100%;
height: 100%;
content:"";
background-color: rgba(22,22,22,0.2);
position: absolute;
top: 0;
}
#keyframes animate{
0%,100%{
background-image: url("Background_Image1");
}
20%{
background-image: url("Background_Image2");
}
40%{
background-image: url("Background_Image3");
}
60%{
background-image: url("Background_Image4");
}
80%{
background-image: url("Background_Image5");
}
}
.container_slider .outer{
width: 100%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50% , -50%);
text-align: center;
}
.container_slider .outer .details{
}
.container_slider .outer .details h1{
font-family: 'Finger Paint', cursive;
font-weight: lighter;
color: #ffffff;
font-size: 70px;
line-height: 77px;
padding: 15px 0;
animation: caption 600ms ease-in-out 1;
}
#keyframes caption {
0%{
transform: translate(0, -20px);
opacity: 0;
}
100%{
transform: translate(0, 0);
opacity: 1;
}
}
.container_slider .outer .details span{
font-family: 'Open Sans';
font-weight: 600;
font-size: 16px;
color: #ffffff;
display: block;
animation: ltlspan 600ms linear 1;
}
#keyframes ltlspan {
0%{
transform: translate(0, 20px);
opacity: 0;
}
100%{
transform: translate(0, 0);
opacity: 1;
}
}
.container_slider .outer .buttons{
width: 100%;
margin-top: 40px;
}
.container_slider .outer a{
background-color: #f8f8f8;
width: 152px;
height: 46px;
line-height: 23px;
border-radius: 100px;
padding: 10px 20px;
margin: 0 10px;
text-decoration: none;
font-family: 'Open Sans', sans-serif;
font-size: 12px;
font-weight: bold;
display: inline-block;
text-align: center;
transition: 300ms;
color: #666666;
animation: abuttons 1300ms ease-in 1;
}
#keyframes abuttons {
0%{
transform: translate(0, -20px);
opacity: 0;
}
100%{
transform: translate(0, 0);
opacity: 1;
}
}
.container_slider .outer a:first-child{
background-color: #109bc5;
color: #ffffff;
border-bottom: 1px solid #0079a3;
}
.container_slider .outer a:first-child:hover{
background-color: rgba(16, 156, 198, 0.9);
}
.container_slider .outer a:nth-child(2):hover{
background-color: rgba(255, 255, 255, 0.86);
color: black;
}
div.box{
width: 100px;
height: 100px;
background-color: blue;
/* I want this box to be displayed below my background image */
}
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght#300&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Open+Sans+Condensed:wght#700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Finger+Paint&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css">
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght#600&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<header>
<div class="header_meta">
<div class="container">
<nav>
<ul>
<li> Registration </li>
<li> Customer Login </li>
</ul>
</nav>
<div class="header_contact"> <span>Call us now: 555-147-5643</span> </div>
</div>
</div>
<div class="header_main">
<div class="container_logo_nav">
<span class="logo"> <img src="images/logo-large.png" alt=""> </span>
<nav class="main_menu">
<ul>
<li><a class="search" href="#"><i class="fa fa-search"></i></a></li>
<li>News</li>
<li>Contact</li>
<li>About</li>
<li>Deals</li>
<li>Destinations</li>
<li>Welcome</li>
</ul>
</nav>
</div>
</div>
</header>
<div class="container_slider">
<div class="outer">
<div class="details">
<h1>To Travel is to live</h1>
<h2>
<span>Want to make a journey? We got the destinations!</span>
</h2>
</div>
<div class="buttons">
ALL DESTINATIONS
LATEST OFFERS
</div>
</div>
</div>
<div class="box"></div>
</body>
</html>
You have set your wrapper to position absolute together with inner. I have changed the .container_slider to relative to wrap properly your slider and box.
[screenshot of the result][1]
here is a screenshot: https://i.stack.imgur.com/8hTNT.jpg
*,
*::before,
*::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
body {
background-color: aqua;
}
header {
z-index: 999999999;
overflow: hidden;
position: sticky;
top: -31px;
}
header .header_main {
background-color: rgba(255, 255, 255, 0.98);
}
header div.header_meta {
font-family: 'Open Sans', sans-serif;
font-weight: bold;
font-size: 11px;
border-bottom: 1px solid rgba(224, 224, 224, 0.56);
}
header div.container {
line-height: 30px;
width: 90%;
margin: auto;
padding: 0 50px;
}
header div.container nav ul {
line-height: 30px;
margin: 0 auto;
float: right;
}
header div.container nav ul li {
float: right;
list-style: none;
}
header div.container nav ul li a {
text-decoration: none;
float: right;
padding: 0 10px;
color: #ffffff;
}
header div.container nav ul li a:hover {
text-decoration: underline;
color: #e6e6e6;
}
header .header_meta .header_contact {
margin: auto;
line-height: 30px;
color: #ffffff;
}
header .header_main {
box-shadow: 0 3px 4px -4px rgba(138, 138, 138, 0.65);
}
header .header_main .container_logo_nav {
width: 90%;
height: 60px;
line-height: 60px;
margin: 0 auto;
padding: 0 4%;
}
header .header_main .container_logo_nav img {
height: 100%;
width: 216px;
float: left;
}
header .header_main .container_logo_nav ul {
float: right;
padding-right: 1%;
}
header .header_main .container_logo_nav ul li {
float: right;
list-style: none;
}
header .header_main .container_logo_nav ul li a {
text-decoration: none;
font-family: 'Open Sans', sans-serif;
font-weight: bolder;
font-size: 14px;
color: #6e6e6e;
padding: 0 13px;
transition: 300ms;
}
header .header_main .container_logo_nav ul li a.search {
font-size: 11px;
}
header .header_main .container_logo_nav ul li a:hover {
color: #000000;
}
.container_slider {
position: relative; /*changed to relative*/
top: 0;
left: 0;
width: 100%;
height: 82vh;
animation: animate 35s ease-in-out infinite;
background-size: cover;
background: no-repeat center;
clear: both;
display: block;
}
.container_slider::before {
width: 100%;
height: 100%;
content: '';
background-color: rgba(22, 22, 22, 0.2);
position: absolute;
top: 0;
}
#keyframes animate {
0%,
100% {
background-image: url('https://www.pexels.com/photo/green-leaf-plant-808510/');
}
20% {
background-image: url('https://www.pexels.com/photo/green-leaf-plant-808510/');
}
40% {
background-image: url('https://www.pexels.com/photo/green-leaf-plant-808510/');
}
60% {
background-image: url('https://www.pexels.com/photo/green-leaf-plant-808510/');
}
80% {
background-image: url('https://www.pexels.com/photo/green-leaf-plant-808510/');
}
}
.container_slider .outer {
width: 100%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
}
.container_slider .outer .details {
}
.container_slider .outer .details h1 {
font-family: 'Finger Paint', cursive;
font-weight: lighter;
color: #ffffff;
font-size: 70px;
line-height: 77px;
padding: 15px 0;
animation: caption 600ms ease-in-out 1;
}
#keyframes caption {
0% {
transform: translate(0, -20px);
opacity: 0;
}
100% {
transform: translate(0, 0);
opacity: 1;
}
}
.container_slider .outer .details span {
font-family: 'Open Sans';
font-weight: 600;
font-size: 16px;
color: #ffffff;
display: block;
animation: ltlspan 600ms linear 1;
}
#keyframes ltlspan {
0% {
transform: translate(0, 20px);
opacity: 0;
}
100% {
transform: translate(0, 0);
opacity: 1;
}
}
.container_slider .outer .buttons {
width: 100%;
margin-top: 40px;
}
.container_slider .outer a {
background-color: #f8f8f8;
width: 152px;
height: 46px;
line-height: 23px;
border-radius: 100px;
padding: 10px 20px;
margin: 0 10px;
text-decoration: none;
font-family: 'Open Sans', sans-serif;
font-size: 12px;
font-weight: bold;
display: inline-block;
text-align: center;
transition: 300ms;
color: #666666;
animation: abuttons 1300ms ease-in 1;
}
#keyframes abuttons {
0% {
transform: translate(0, -20px);
opacity: 0;
}
100% {
transform: translate(0, 0);
opacity: 1;
}
}
.container_slider .outer a:first-child {
background-color: #109bc5;
color: #ffffff;
border-bottom: 1px solid #0079a3;
}
.container_slider .outer a:first-child:hover {
background-color: rgba(16, 156, 198, 0.9);
}
.container_slider .outer a:nth-child(2):hover {
background-color: rgba(255, 255, 255, 0.86);
color: black;
}
div.box {
width: 100px;
height: 100px;
background-color: blue;
/* I want this box to be displayed below my background image */
}
So, I got a navigation bar with dropdown menus. Whenever I move my cursor where the drop-down menu is hidden, it opens, and I need to disable that without disabling the drop-down menu as a whole. Any tips on how to do that?
If you want to go ahead and look at the latest version of my website can be found below.
Here's the link: https://p1ayerone.github.io/
And here's the CSS code:
#import url('https://fonts.googleapis.com/css2?family=Roboto:wght#300&display=swap');
:root {
--background: rgba(54, 57, 63, .85);
}
*,
*::before,
*::after {
margin: 0px;
padding: 0px;
box-sizing: inherit;
box-sizing: border-box;
}
body {
margin: 0;
padding: 0;
background: url(../../img/bg/bg.png) fixed center;
background-attachment: fixed;
background-position: center;
font-family: 'Roboto', sans-serif;
font-weight: 400;
box-sizing: border-box;
color: silver;
}
.content {
height: 200vh;
background-size: cover;
display: grid;
place-items: center;
}
/* navigation styles start here */
header {
z-index: 999;
width: 100%;
right: 0%;
top: 0%;
position: fixed;
}
.logo {
margin: 0;
color: silver;
list-style: none;
}
.img-logo {
margin-right: 15px;
padding-top: 8px;
margin-bottom: -10px;
}
.nav-toggle {
display: none;
}
.nav-toggle-label {
position: absolute;
top: 0;
left: 0;
margin-left: 1em;
height: 100%;
display: flex;
align-items: left;
margin-top: 3.5%;
}
.nav-toggle-label span,
.nav-toggle-label span::before,
.nav-toggle-label span::after {
display: block;
background: white;
height: 2px;
width: 2em;
border-radius: 2px;
position: relative;
}
.nav-toggle-label span::before,
.nav-toggle-label span::after {
content: '';
position: absolute;
}
.nav-toggle-label span::before {
bottom: 7px;
}
.nav-toggle-label span::after {
top: 7px;
}
.nav {
text-transform: uppercase;
font-size: 1.2rem;
background: var(--background);
padding-bottom: 1.7%;
}
.nav::after {
content: "";
display: table;
clear: both;
}
.nav-main {
float: right;
list-style: none;
margin-bottom: -21px;
padding-bottom: -15px;
}
.nav-main-item {
display: inline-block;
width: 12rem;
position: relative;
}
li {
list-style: none;
}
.nav-main a {
text-align: center;
padding: 1rem;
color: #eee;
text-decoration: none;
display: block;
}
.nav-main-item a:hover {
background-color: gray;
}
.nav-main-item:hover > * {
opacity: 1;
margin: 0;
}
.navi-main-item {
opacity: 0;
position: absolute;
width: 100%;
top: 100%;
z-index: -1;
background: var(--background);
box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.8);
}
.more-main-item {
opacity: 0;
position: absolute;
width: 100%;
top: 100%;
z-index: -1;
background: var(--background);
box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.8);
}
.nav-toggle:checked ~ nav {
transform: scale(1,1);
}
.nav-toggle:checked ~ nav a {
opacity: 1;
transition: opacity 250ms ease-in-out 250ms;
}
.destiny-intro-p {
padding-left: 100px;
font-size: 1.3rem;
}
.destiny-intro-h1 {
font-size: 3rem;
}
.body-block {
background-color: black;
color: white;
padding-bottom: 6%;
}
#media screen and (min-width: 800px) {
.nav-toggle-label {
display: none;
}
header {
z-index: 999;
width: 100%;
right: 0%;
top: 0%;
position: fixed;
}
.logo {
margin: 0;
color: silver;
list-style: none;
padding-top: 15;
}
.nav {
text-transform: uppercase;
font-size: 1.2rem;
background: var(--background);
}
.nav::after {
content: "";
display: table;
clear: both;
}
.nav-main {
float: right;
list-style: none;
}
.nav-main-item {
display: inline-block;
width: 10rem;
position: relative;
}
.nav-main a {
text-align: center;
padding: 1rem;
color: white;
text-decoration: none;
display: block;
}
.nav-main-item a:hover {
background-color: silver;
}
.nav-main-item:hover > * {
opacity: 1;
margin: 0;
}
.navi-main-item {
opacity: 0;
position: absolute;
width: 100%;
top: 100%;
z-index: -1;
background: var(--background);
box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.8);
}
.Discord {
float: right;
}
.gif-Destiny {
width: 200px;
float: right;
color: silver;
}
.Zachary {
color: black;
text-decoration: none;
}
.introduction {
color: black;
}
.footer {
background-color: #1F2E4B;
color: white;
text-align: center;
font-size: 20px;
float: center;
margin-top: 100%;
}
.CbZD{
color: #00FFFF;
font-size: 30px;
}
}
.Discord {
float: right;
}
.img-Destiny {
padding-top: 0px;
width: 300px;
float: right;
color: black;
}
.Zachary {
color: black;
text-decoration: none;
}
.introduction {
color: black;
}
.footer {
background-color: #1F2E4B;
color: white;
text-align: center;
font-size: 20px;
float: center;
}
.CbZD{
color: #00FFFF;
font-size: 30px;
}
/* Videos */
.tse {
color: #07FC1B;
text-align: center;
}
/* Characters */
.img-TBG {
background-color: white;
color: black;
float: left;
width: 300px;
height: 500px;
}
/* Applications */
.silver-box {
background-color: silver;
color: black;
height: 1400px;
width: 640px;
}
/* About Me */
.abtme {
width: 50%;
margin: 0 auto;
}
/* Links */
.contact-me {
color: silver;
}
.gmail-footer {
color: silver;
}
.twitter-footer {
color: silver;
}
/* Contact */
.contact-title {
margin-top: 100px;
color: white;
text-transform: uppercase;
transition: all 4s ease-in-out;
}
.contact-title h1 {
font-size: 32px;
line-height: -10px;
}
.contact-title h2 {
font-size: 16px;
}
form {
margin-top: 50px;
transition: all 4s ease-in-out;
}
.form-control {
width: 600px;
background: var(--background);
border: none;
outline: none;
border-bottom: 1px solid gray;
color: white;
font-size: 18px;
margin-bottom: 16px;
}
input {
height: 45px;
}
form .submit {
background: #ff5722;
border-color: transparent;
color: #fff;
font-size: 20px;
font-weight: bold;
letter-spacing: 2px;
height: 50px;
margin-top: 20px;
}
form .submit:hover {
background-color: #f44336;
cursor: pointer;
}
Instead of using opacity:0 and opacity:1 to display the dropdown, you can use display:none and display:inline-block. When using opacity, it doesn't remove the element from the page, which is why the dropdown would appear when hovering in that area.
Can read more about this here https://magnusbenoni.com/difference-between-display-visibility-opacity/
.nav-main-item:hover > .navi-main-item {
display: inline-block;
margin: 0;
}
.navi-main-item {
display: none;
position: absolute;
width: 100%;
top: 100%;
z-index: -1;
background: var(--background);
box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.8);
}
Hey I have the problem that my hover effect doesn't work properly in google chrome. See GIF:https://giphy.com/gifs/GsUXBgcokM96zmlQkj. It works in Firefox. Can someone help me to get it running on Chrome? I think the problem lies in my CSS of #flat (js is not important here).
CodePen: https://codepen.io/NesR0M/pen/KKMzvjO.
var clicked = true;
function flattoZero(){
document.getElementById("flat").style.top = "0%";
document.getElementById("flat").style.left = "0%";
}
function flattotheRight(){
document.getElementById("flat").style.top = "1%";
document.getElementById("flat").style.left = "1%";
}
function flattotheLeft(){
document.getElementById("flat").style.top = "1%";
document.getElementById("flat").style.left = "-1%";
}
function burgerclick() {
const card = document.getElementById("flipable");
card.classList.toggle("flip-card-inner-active");
flattoZero();
setTimeout(function(){ flattotheLeft(); }, 500);
clicked = false;
}
function clickback() {
const card = document.getElementById("flipable");
card.classList.toggle("flip-card-inner-active");
flattoZero();
setTimeout(function(){ flattotheRight(); }, 500);
clicked = true;
}
function mouseOver() {
if(clicked){
flattoZero();
}
}
function mouseOut() {
if(clicked){
flattotheRight();
}
}
function mouseOverflipped() {
if(!clicked){
flattoZero();
}
}
function mouseOutflipped() {
if(!clicked){
flattotheLeft();
}
}
:root {
/*
--font-color: rgb(255, 238, 232);
--flat-color: rgb(255, 114, 67);
--main-background-color:rgb(255, 213, 197);
*/
/*
--font-colorF: rgb(255, 255, 255);
--flat-colorF: rgb(255, 242, 67);
--main-background-colorF:rgb(42, 42, 44);
*/
--font-colorF: rgb(255, 255, 255);
--flat-colorF: rgb(67, 170, 255);
--main-background-colorF:rgb(42, 42, 44);
--font-color: rgb(255, 255, 255);
--font-hover-color: white;
--font-underline-color: white;
--nav-font-color: rgb(65, 65, 65);
--burger-color: var(--font-color);
--shadow-color: rgba(58, 58, 58, 0.2);
--main-background-color: rgb(175, 175, 175);
}
body{
/*Futura PT Light*/
font-family: futura-pt, sans-serif;
font-weight: 600;
font-style: italic;
color: var(--font-colorF);
background-color: var(--main-background-colorF);
width: 100%;
height: 100vh;
margin: 0px;
display: flex;
align-items: center;
justify-content: center;
transition: all 400ms ease-out;
}
#desktop{
height: 100%;
width: auto;
}
.leftcenter {
position: absolute;
font-size: 12vmin;
top: 50%;
left: 29%;
transform: translate(-50%, -50%);
transition: 0.30s;
}
.rightcenter {
position: absolute;
font-size: 12vmin;
top: 50%;
left: 75%;
transform: translate(-50%, -50%);
transition: 0.30s;
}
.burger{
position: absolute;
top: 5%;
left: 2.5%;
cursor: pointer;
}
.burger div{
height: 4px;
background-color: var(--burger-color);
margin: 5px;
border-radius: 50px;
transition: 0.3s;
}
.line1{
width: 36px;
}
.line2{
width: 24px;
}
.line3{
width: 30px;
}
.burger:hover div{
width: 36px;
}
.nav{
list-style-type:none;
font-size: 6vmin;
font-weight: 500;
}
.flip-card {
perspective: 10000px;
display: flex;
align-items: center;
justify-content: center;
position: relative;
height: 100%;
width: 100%;
overflow: hidden;
}
.flip-card-inner {
position: relative;
height: 80%;
width: 90%;
max-width: 162vh;
transition-timing-function: ease;
transition-duration: 0.5s;
transform-style: preserve-3d;
}
.flip-card-inner-active {
transform: rotateY(180deg);
}
.flip-card-front, .flip-card-back {
background-color: black;
position: absolute;
height: 100%;
width: 100%;
-webkit-backface-visibility: hidden; /* Safari */
backface-visibility: hidden;
overflow: hidden;
box-shadow: none;
}
.flip-card-front {
display: flex;
align-items: center;
justify-content: center;
}
.flip-card-back {
display: flex;
align-items: center;
justify-content: center;
color: var(--font-color);
transform: rotateY(180deg);
}
ul {
display: flex;
flex-direction: column;
list-style-type: none;
align-items: start;
justify-content: space-between;
}
ul li {
padding: 6px 0;
}
ul li p {
cursor: pointer;
position: relative;
display: block;
padding: 4px 0;
font-weight: 500;
font-size: 4vh;
color: var(--nav-font-color);
text-decoration: none;
text-transform: uppercase;
transition: 0.5s;
font-family: 'Raleway', sans-serif;
font-size: 4vh;
text-transform: lowercase;
}
ul li p::after {
position: absolute;
content: "";
top: 100%;
left: 0;
width: 100%;
height: 3px;
background: var(--font-underline-color);
transform: scaleX(0);
transform-origin: right;
transition: transform 0.5s;
}
ul li p:hover {
color: var(--font-hover-color);
}
ul li p:hover::after {
transform: scaleX(1);
transform-origin: left;
}
#flat{
position: absolute;
height: 100%;
width: 100%;
top: 1%;
left: 1%;
background-color: var(--flat-colorF);
z-index: -5;
transition: 0.3s;
}
#media screen and (max-width: 100vh){
.leftcenter {
font-size: 6vmin;
top: 8.2%;
left: 62%;
}
.rightcenter{
font-size: 6vmin;
top: 8.2%;
left: 85%;
}
}
<div class="flip-card">
<div class="flip-card-inner" id="flipable">
<div class="flip-card-front">
<img id="desktop" src="img/_1080374.jpg" alt="Picture">
<div class="leftcenter">NAME</div>
<div class="rightcenter">NAME</div>
<div class="burger" onclick="burgerclick()" onmouseover="mouseOver()" onmouseout="mouseOut()">
<div class="line1"></div>
<div class="line2"></div>
<div class="line3"></div>
</div>
</div>
<div class="flip-card-back">
<ul>
<li><p id="home" onclick="clickback()" onmouseover="mouseOverflipped()" onmouseout="mouseOutflipped()">BACK</p></li>
<li><p>ABOUT ME</p></li>
<li><p>PROJECTS</p></li>
<li><p>CONTACT</p></li>
</ul>
</div>
<div id="flat"></div>
</div>
</div>
<script src="js/script.js"></script>
Looks like the front of the card gets in front of the back of the card even after the rotation, just the left part (that's why you can hover in the right part). A quick fix is to add a little space between both faces with translate3d(0, 0, 1px) in the .flip-card-back element:
var clicked = true;
function flattoZero(){
document.getElementById("flat").style.top = "0%";
document.getElementById("flat").style.left = "0%";
}
function flattotheRight(){
document.getElementById("flat").style.top = "1%";
document.getElementById("flat").style.left = "1%";
}
function flattotheLeft(){
document.getElementById("flat").style.top = "1%";
document.getElementById("flat").style.left = "-1%";
}
function burgerclick() {
const card = document.getElementById("flipable");
card.classList.toggle("flip-card-inner-active");
flattoZero();
setTimeout(function(){ flattotheLeft(); }, 500);
clicked = false;
}
function clickback() {
const card = document.getElementById("flipable");
card.classList.toggle("flip-card-inner-active");
flattoZero();
setTimeout(function(){ flattotheRight(); }, 500);
clicked = true;
}
function mouseOver() {
if(clicked){
flattoZero();
}
}
function mouseOut() {
if(clicked){
flattotheRight();
}
}
function mouseOverflipped() {
if(!clicked){
flattoZero();
}
}
function mouseOutflipped() {
if(!clicked){
flattotheLeft();
}
}
:root {
/*
--font-color: rgb(255, 238, 232);
--flat-color: rgb(255, 114, 67);
--main-background-color:rgb(255, 213, 197);
*/
/*
--font-colorF: rgb(255, 255, 255);
--flat-colorF: rgb(255, 242, 67);
--main-background-colorF:rgb(42, 42, 44);
*/
--font-colorF: rgb(255, 255, 255);
--flat-colorF: rgb(67, 170, 255);
--main-background-colorF:rgb(42, 42, 44);
--font-color: rgb(255, 255, 255);
--font-hover-color: white;
--font-underline-color: white;
--nav-font-color: rgb(65, 65, 65);
--burger-color: var(--font-color);
--shadow-color: rgba(58, 58, 58, 0.2);
--main-background-color: rgb(175, 175, 175);
}
body{
/*Futura PT Light*/
font-family: futura-pt, sans-serif;
font-weight: 600;
font-style: italic;
color: var(--font-colorF);
background-color: var(--main-background-colorF);
width: 100%;
height: 100vh;
margin: 0px;
display: flex;
align-items: center;
justify-content: center;
transition: all 400ms ease-out;
}
#desktop{
height: 100%;
width: auto;
}
.leftcenter {
position: absolute;
font-size: 12vmin;
top: 50%;
left: 29%;
transform: translate(-50%, -50%);
transition: 0.30s;
}
.rightcenter {
position: absolute;
font-size: 12vmin;
top: 50%;
left: 75%;
transform: translate(-50%, -50%);
transition: 0.30s;
}
.burger{
position: absolute;
top: 5%;
left: 2.5%;
cursor: pointer;
}
.burger div{
height: 4px;
background-color: var(--burger-color);
margin: 5px;
border-radius: 50px;
transition: 0.3s;
}
.line1{
width: 36px;
}
.line2{
width: 24px;
}
.line3{
width: 30px;
}
.burger:hover div{
width: 36px;
}
.nav{
list-style-type:none;
font-size: 6vmin;
font-weight: 500;
}
.flip-card {
perspective: 10000px;
display: flex;
align-items: center;
justify-content: center;
position: relative;
height: 100%;
width: 100%;
overflow: hidden;
}
.flip-card-inner {
position: relative;
height: 80%;
width: 90%;
max-width: 162vh;
transition-timing-function: ease;
transition-duration: 0.5s;
transform-style: preserve-3d;
}
.flip-card-inner-active {
transform: rotateY(180deg);
}
.flip-card-front, .flip-card-back {
background-color: black;
position: absolute;
height: 100%;
width: 100%;
-webkit-backface-visibility: hidden; /* Safari */
backface-visibility: hidden;
overflow: hidden;
box-shadow: none;
}
.flip-card-front {
display: flex;
align-items: center;
justify-content: center;
}
.flip-card-back {
display: flex;
align-items: center;
justify-content: center;
color: var(--font-color);
transform: rotateY(180deg) translate3d(0, 0, 1px);
}
ul {
display: flex;
flex-direction: column;
list-style-type: none;
align-items: start;
justify-content: space-between;
}
ul li {
padding: 6px 0;
}
ul li p {
cursor: pointer;
position: relative;
display: block;
padding: 4px 0;
font-weight: 500;
font-size: 4vh;
color: var(--nav-font-color);
text-decoration: none;
text-transform: uppercase;
transition: 0.5s;
font-family: 'Raleway', sans-serif;
font-size: 4vh;
text-transform: lowercase;
}
ul li p::after {
position: absolute;
content: "";
top: 100%;
left: 0;
width: 100%;
height: 3px;
background: var(--font-underline-color);
transform: scaleX(0);
transform-origin: right;
transition: transform 0.5s;
}
ul li p:hover {
color: var(--font-hover-color);
}
ul li p:hover::after {
transform: scaleX(1);
transform-origin: left;
}
#flat{
position: absolute;
height: 100%;
width: 100%;
top: 1%;
left: 1%;
background-color: var(--flat-colorF);
z-index: -5;
transition: 0.3s;
}
#media screen and (max-width: 100vh){
.leftcenter {
font-size: 6vmin;
top: 8.2%;
left: 62%;
}
.rightcenter{
font-size: 6vmin;
top: 8.2%;
left: 85%;
}
}
<div class="flip-card">
<div class="flip-card-inner" id="flipable">
<div class="flip-card-front">
<img id="desktop" src="img/_1080374.jpg" alt="Picture">
<div class="leftcenter">NAME</div>
<div class="rightcenter">NAME</div>
<div class="burger" onclick="burgerclick()" onmouseover="mouseOver()" onmouseout="mouseOut()">
<div class="line1"></div>
<div class="line2"></div>
<div class="line3"></div>
</div>
</div>
<div class="flip-card-back">
<ul>
<li><p id="home" onclick="clickback()" onmouseover="mouseOverflipped()" onmouseout="mouseOutflipped()">BACK</p></li>
<li><p>ABOUT ME</p></li>
<li><p>PROJECTS</p></li>
<li><p>CONTACT</p></li>
</ul>
</div>
<div id="flat"></div>
</div>
</div>
<script src="js/script.js"></script>