I am fairly new to HTMl and CSS. I had my footer stuck to the bottom of the page no problem and then something changed and I cannot figure it out. When I go to a page without a lot of content the footer sits in the middle of the page. On pages with content, it works as it should. I have read countless other posts with the same issue and nothing seems to work. Using "position:fixed" makes the footer stuck to the bottom of the "viewport" not the page itself. Thus when I switch to another page with scrollable content, the footer shows itself behind the page content. I've tried adding "overflow:hidden", "bottom:0;", "left:0" and "right:0" to .main-footer and that doesn't fix it. I don't know what I'm missing. I have already spent a few hours looking up answers and trying to solve this issue.
*, *::before, *::after {
box-sizing: border-box;
font-family: 'Abel', sans-serif;
color: #777;
}
body {
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
height: 100vh;
}
/* Styles for navigation menus */
nav ul {
margin: 0;
}
nav li{
display: inline-block;
}
nav a {
display: inline-flex;
padding: .5em;
margin-top: 5px;
margin-bottom: 5px;
color: white;
text-decoration: none;
transition: 350ms;
}
nav a:hover {
background-color: rgba(215, 200, 200, .3);
border-radius: 2px;
}
/*Style for MAIN navigation menu*/
.main-nav {
text-align: center;
font-size: 1.1em;
font-weight: lighter;
border-bottom: 1px solid rgba(215, 200, 200, .3);
}
.main-nav li {
padding: 0 5%;
}
.main-header {
background-image: url('headerfooterimages/headerpicture.jpg');
background-size: cover;
background-color: rgba(0, 0, 0, 0.5);
background-blend-mode: multiply;
padding-bottom: 25px;
border-bottom: 1px solid black;
}
/* Style for Page Title/Logo */
.titleLogo {
text-align: center;
margin: auto;
font-size: 4em;
font-family: 'Bebas Neue';
color: white;
}
.titleLogo-large {
font-size: 6em;
}
/*Styles for sections of content on page*/
.content-section {
margin: 1em;
padding: 2em;
}
.content-container {
max-width: 900px;
margin: 0 auto;
padding: 0 1.5em;
}
.section-header {
font-family: Impact;
font-weight: normal;
color: rgb(34, 34, 34);
}
/*Styling the footer for each page*/
.main-footer {
background-color: rgb(45, 45, 45);
padding: 5px;
position: relative;
bottom: 0;
width: 100vw;
height: 75px;
border-top: 1px solid black;
margin: auto;
}
.footer-text {
font-size: 25px;
color: rgba(128, 128, 128);
display: inline-flex;
}
.footer-text:hover {
text-shadow: 0px 0px 40px rgba(255, 255, 255, 0.75);
cursor: crosshair;
color:rgb(188, 188, 188);
}
.main-footer-container {
display: flex;
align-items: center;
}
.main-footer-container ul {
flex-grow: 1;
text-align: end;
}
/*Styling the social media links in the footer*/
.footer-nav li {
list-style: none;
display: inline-flex;
transition: 350ms;
}
.footer-nav img {
border-radius: 5px;
width: 30px;
height: 30px;
}
.footer-nav li:hover {
background-color: rgba(215, 200, 200, .3);
border-radius: 5px;
padding-left: 3px;
padding-right: 3px;
padding-top: 3px;
}
/*Styling buttons across the whole site*/
.btn {
background-color: #349aff;
border: none;
border-radius: 1em;
color: white;
padding: 8px 16px;
vertical-align: middle;
text-align: center;
text-decoration: none;
font-size: 8px;
font-weight: bold;
box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.5);
}
.btn:hover {
background-color: #2090ff;
cursor: pointer;
box-shadow: none;
}
/*Styling the cart menu option in the main navigation*/
.cart-container{
display: inline-flex;
margin: auto;
}
.cart-icon {
float: left;
clear: left;
height: 25px;
}
.cart-text {
display:inline-block;
color: white;
padding: 2px;
margin-top: 1px;
}
.cart-text:hover {
text-decoration: underline;
}
/*Styling shop items*/
.shop-item {
display: block;
margin: 50px;
}
.shop-item-image {
display: block;
margin: 10px;
height: 200px;
}
.shop-item-title {
display: block;
text-align: center;
width: 100%;
font-weight: bold;
font-size: 1.1em;
color: #333;
margin-bottom: 5px;
}
.shop-item-details {
display: flex;
align-items: center;
}
.shop-item-price {
display: block;
text-align: center;
color: #333;
width: 50%;
}
.shop-item-button {
display: block;
}
.shop-items {
display: flex;
flex-wrap: wrap;
justify-content: space-around;
}
/*Styling the image carousel*/
.carousel {
width: 600px;
height: 400px;
position: relative;
display: flex;
}
.carousel > ul {
margin: 0px;
padding: 0px;
list-style: none;
}
.carousel-container {
margin: auto;
align-items: center;
}
/*Styling the buttons on the carousel*/
.carousel-button {
position: absolute;
padding: 0 .25rem;
z-index: 2;
background: none;
background-color: rgba(0, 0, 0, .1);
border: none;
border-radius: .25rem;
font-size: 2.5rem;
top: 50%;
transform: translateY(-120%);
color: rgba(255, 255, 255, .5);
cursor: pointer;
}
.carousel-button:hover, .carousel-button:focus {
color: white;
background-color: rgba(0, 0, 0, .2);
}
.carousel-button:focus {
outline: 1px solid black;
}
.carousel-button.prev {
left: 1rem;
}
.carousel-button.next {
right: 12rem;
}
/*Styling and formatting the next image effect for the image carousel*/
.slide {
position: absolute;
inset: 0;
opacity: 0;
object-fit: fill;
transition: 400ms opacity ease-in-out;
transition-delay: 200ms;
}
.slide > img {
display: inline-block;
width: 70%;
height: 80%;
border-radius: 10px;
object-fit: cover;
box-shadow: 0px 0px 30px rgba(0, 0, 0, 0.5);
}
.slide[data-active] {
opacity: 1;
z-index: 1;
transition-delay: 0ms;
}
<!DOCTYPE html>
<html lang = "enUS">
<head>
<title>Modern Style</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta charset="utf-8">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Abel&family=Bebas+Neue" rel="stylesheet">
<link rel="favicon" href="favicon.ico">
<link rel="stylesheet" href="stylesheet.css">
<script src="script.js" defer></script>
</head>
<body>
<header class="main-header">
<nav class="nav main-nav">
<ul>
<li>HOME</li>
<li>ABOUT</li>
<li>STORE</li>
<li class="cart-container"><a href="cart.html"><img class="cart-icon" src="headerfooterimages/cart.png" alt="A shopping cart icon">
<div class="cart-text">Shopping Cart</div></a></li>
</ul>
</nav>
<h1 class="titleLogo titleLogo-large">Modern Style Website</h1>
</header>
<section class="content-section content-container">
<h2 class="section-header">ABOUT</h2>
<p>
This is placeholder text. This is placeholder text. This is placeholder text. This is placeholder text. This is placeholder text.
This is placeholder text. This is placeholder text. This is placeholder text. This is placeholder text. This is placeholder text.
This is placeholder text. This is placeholder text. This is placeholder text. This is placeholder text. This is placeholder text.
This is placeholder text. This is placeholder text. This is placeholder text. This is placeholder text. This is placeholder text.
This is placeholder text. This is placeholder text. This is placeholder text. This is placeholder text. This is placeholder text.
This is placeholder text. This is placeholder text. This is placeholder text. This is placeholder text. This is placeholder text.
</p>
</section>
</body>
<footer class="main-footer">
<div class="main-footer-container">
<h2 class="footer-text">Modern Style Website</h2>
<ul class="nav footer-nav">
<li><img src="headerfooterimages/Facebook-Logo.png"></li>
<li><img src="headerfooterimages/Instagram-Logo.png"></li>
<li><img src="headerfooterimages/Twitter-Logo.png"></li>
</ul>
</div>
</footer>
</html>
Seeing as you have declared the body to be 100vh, you can utilize this empty space with margin-top: auto.
On main-footer, remove margin: auto and replace it with margin-top: auto. This way, it will convert the remaining space on the body element into a margin-top-value for the main-footer element.
On another note,
make sure to include the <footer>-element BEFORE your closing </body>-tag, the footer is supposed to be inside the <body>-element.
Also, in your CSS reset, I would consider adding margin: 0; to avoid white bars on your site.
Codepen (because the code snippet is so long): https://codepen.io/sigurdmazanti/pen/ZErJzEK
.main-footer {
background-color: rgb(45, 45, 45);
padding: 5px;
position: relative;
bottom: 0;
width: 100vw;
height: 75px;
border-top: 1px solid black;
/*margin: auto;*/
margin-top: auto;
}
just use this css code:
i have added multiple values to body and remove margin from footer
*, *::before, *::after {
box-sizing: border-box;
font-family: 'Abel', sans-serif;
color: #777;
}
body {
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
min-height: 100vh;
flex-wrap: nowrap;
align-content: space-between;
justify-content: space-between;
align-items: stretch;
}
/* Styles for navigation menus */
nav ul {
margin: 0;
}
nav li{
display: inline-block;
}
nav a {
display: inline-flex;
padding: .5em;
margin-top: 5px;
margin-bottom: 5px;
color: white;
text-decoration: none;
transition: 350ms;
}
nav a:hover {
background-color: rgba(215, 200, 200, .3);
border-radius: 2px;
}
/*Style for MAIN navigation menu*/
.main-nav {
text-align: center;
font-size: 1.1em;
font-weight: lighter;
border-bottom: 1px solid rgba(215, 200, 200, .3);
}
.main-nav li {
padding: 0 5%;
}
.main-header {
background-image: url('headerfooterimages/headerpicture.jpg');
background-size: cover;
background-color: rgba(0, 0, 0, 0.5);
background-blend-mode: multiply;
padding-bottom: 25px;
border-bottom: 1px solid black;
}
/* Style for Page Title/Logo */
.titleLogo {
text-align: center;
margin: auto;
font-size: 4em;
font-family: 'Bebas Neue';
color: white;
}
.titleLogo-large {
font-size: 6em;
}
/*Styles for sections of content on page*/
.content-section {
margin: 1em;
padding: 2em;
}
.content-container {
max-width: 900px;
margin: 0 auto;
padding: 0 1.5em;
}
.section-header {
font-family: Impact;
font-weight: normal;
color: rgb(34, 34, 34);
}
/*Styling the footer for each page*/
.main-footer {
background-color: rgb(45, 45, 45);
padding: 5px;
position: relative;
bottom: 0;
width: 100vw;
height: 75px;
border-top: 1px solid black;
}
.footer-text {
font-size: 25px;
color: rgba(128, 128, 128);
display: inline-flex;
}
.footer-text:hover {
text-shadow: 0px 0px 40px rgba(255, 255, 255, 0.75);
cursor: crosshair;
color:rgb(188, 188, 188);
}
.main-footer-container {
display: flex;
align-items: center;
}
.main-footer-container ul {
flex-grow: 1;
text-align: end;
}
/*Styling the social media links in the footer*/
.footer-nav li {
list-style: none;
display: inline-flex;
transition: 350ms;
}
.footer-nav img {
border-radius: 5px;
width: 30px;
height: 30px;
}
.footer-nav li:hover {
background-color: rgba(215, 200, 200, .3);
border-radius: 5px;
padding-left: 3px;
padding-right: 3px;
padding-top: 3px;
}
/*Styling buttons across the whole site*/
.btn {
background-color: #349aff;
border: none;
border-radius: 1em;
color: white;
padding: 8px 16px;
vertical-align: middle;
text-align: center;
text-decoration: none;
font-size: 8px;
font-weight: bold;
box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.5);
}
.btn:hover {
background-color: #2090ff;
cursor: pointer;
box-shadow: none;
}
/*Styling the cart menu option in the main navigation*/
.cart-container{
display: inline-flex;
margin: auto;
}
.cart-icon {
float: left;
clear: left;
height: 25px;
}
.cart-text {
display:inline-block;
color: white;
padding: 2px;
margin-top: 1px;
}
.cart-text:hover {
text-decoration: underline;
}
/*Styling shop items*/
.shop-item {
display: block;
margin: 50px;
}
.shop-item-image {
display: block;
margin: 10px;
height: 200px;
}
.shop-item-title {
display: block;
text-align: center;
width: 100%;
font-weight: bold;
font-size: 1.1em;
color: #333;
margin-bottom: 5px;
}
.shop-item-details {
display: flex;
align-items: center;
}
.shop-item-price {
display: block;
text-align: center;
color: #333;
width: 50%;
}
.shop-item-button {
display: block;
}
.shop-items {
display: flex;
flex-wrap: wrap;
justify-content: space-around;
}
/*Styling the image carousel*/
.carousel {
width: 600px;
height: 400px;
position: relative;
display: flex;
}
.carousel > ul {
margin: 0px;
padding: 0px;
list-style: none;
}
.carousel-container {
margin: auto;
align-items: center;
}
/*Styling the buttons on the carousel*/
.carousel-button {
position: absolute;
padding: 0 .25rem;
z-index: 2;
background: none;
background-color: rgba(0, 0, 0, .1);
border: none;
border-radius: .25rem;
font-size: 2.5rem;
top: 50%;
transform: translateY(-120%);
color: rgba(255, 255, 255, .5);
cursor: pointer;
}
.carousel-button:hover, .carousel-button:focus {
color: white;
background-color: rgba(0, 0, 0, .2);
}
.carousel-button:focus {
outline: 1px solid black;
}
.carousel-button.prev {
left: 1rem;
}
.carousel-button.next {
right: 12rem;
}
/*Styling and formatting the next image effect for the image carousel*/
.slide {
position: absolute;
inset: 0;
opacity: 0;
object-fit: fill;
transition: 400ms opacity ease-in-out;
transition-delay: 200ms;
}
.slide > img {
display: inline-block;
width: 70%;
height: 80%;
border-radius: 10px;
object-fit: cover;
box-shadow: 0px 0px 30px rgba(0, 0, 0, 0.5);
}
.slide[data-active] {
opacity: 1;
z-index: 1;
transition-delay: 0ms;
}
Use this CSS. It will also top align your content-section. I fixed horizontal scroll as well. Just make sure to keep your website content inside of body tags. Your footer was outside of the body tag.
*, *::before, *::after {
box-sizing: border-box;
font-family: 'Abel', sans-serif;
color: #777;
}
body {
margin: 0;
padding: 0;
min-height: 100vh;
display: flex;
flex-direction: column;
}
/* Styles for navigation menus */
nav ul {
margin: 0;
}
nav li{
display: inline-block;
}
nav a {
display: inline-flex;
padding: .5em;
margin-top: 5px;
margin-bottom: 5px;
color: white;
text-decoration: none;
transition: 350ms;
}
nav a:hover {
background-color: rgba(215, 200, 200, .3);
border-radius: 2px;
}
/*Style for MAIN navigation menu*/
.main-nav {
text-align: center;
font-size: 1.1em;
font-weight: lighter;
border-bottom: 1px solid rgba(215, 200, 200, .3);
}
.main-nav li {
padding: 0 5%;
}
.main-header {
background-image: url('headerfooterimages/headerpicture.jpg');
background-size: cover;
background-color: rgba(0, 0, 0, 0.5);
background-blend-mode: multiply;
padding-bottom: 25px;
border-bottom: 1px solid black;
}
/* Style for Page Title/Logo */
.titleLogo {
text-align: center;
margin: auto;
font-size: 4em;
font-family: 'Bebas Neue';
color: white;
}
.titleLogo-large {
font-size: 6em;
}
/*Styles for sections of content on page*/
.content-section {
margin: 1em;
padding: 2em;
width: 100%;
box-sizing: border-box;
position: relative;
flex-grow: 1;
}
.content-container {
max-width: 900px;
margin: 0 auto;
padding: 0 1.5em;
box-sizing: border-box;
}
.section-header {
font-family: Impact;
font-weight: normal;
color: rgb(34, 34, 34);
}
/*Styling the footer for each page*/
.main-footer {
background-color: rgb(45, 45, 45);
padding: 5px;
position: relative;
bottom: 0;
width: 100%;
height: 75px;
border-top: 1px solid black;
margin: auto;
}
.footer-text {
font-size: 25px;
color: rgba(128, 128, 128);
display: inline-flex;
}
.footer-text:hover {
text-shadow: 0px 0px 40px rgba(255, 255, 255, 0.75);
cursor: crosshair;
color:rgb(188, 188, 188);
}
.main-footer-container {
display: flex;
align-items: center;
}
.main-footer-container ul {
flex-grow: 1;
text-align: end;
}
/*Styling the social media links in the footer*/
.footer-nav li {
list-style: none;
display: inline-flex;
transition: 350ms;
}
.footer-nav img {
border-radius: 5px;
width: 30px;
height: 30px;
}
.footer-nav li:hover {
background-color: rgba(215, 200, 200, .3);
border-radius: 5px;
padding-left: 3px;
padding-right: 3px;
padding-top: 3px;
}
/*Styling buttons across the whole site*/
.btn {
background-color: #349aff;
border: none;
border-radius: 1em;
color: white;
padding: 8px 16px;
vertical-align: middle;
text-align: center;
text-decoration: none;
font-size: 8px;
font-weight: bold;
box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.5);
}
.btn:hover {
background-color: #2090ff;
cursor: pointer;
box-shadow: none;
}
/*Styling the cart menu option in the main navigation*/
.cart-container{
display: inline-flex;
margin: auto;
}
.cart-icon {
float: left;
clear: left;
height: 25px;
}
.cart-text {
display:inline-block;
color: white;
padding: 2px;
margin-top: 1px;
}
.cart-text:hover {
text-decoration: underline;
}
/*Styling shop items*/
.shop-item {
display: block;
margin: 50px;
}
.shop-item-image {
display: block;
margin: 10px;
height: 200px;
}
.shop-item-title {
display: block;
text-align: center;
width: 100%;
font-weight: bold;
font-size: 1.1em;
color: #333;
margin-bottom: 5px;
}
.shop-item-details {
display: flex;
align-items: center;
}
.shop-item-price {
display: block;
text-align: center;
color: #333;
width: 50%;
}
.shop-item-button {
display: block;
}
.shop-items {
display: flex;
flex-wrap: wrap;
justify-content: space-around;
}
/*Styling the image carousel*/
.carousel {
width: 600px;
height: 400px;
position: relative;
display: flex;
}
.carousel > ul {
margin: 0px;
padding: 0px;
list-style: none;
}
.carousel-container {
margin: auto;
align-items: center;
}
/*Styling the buttons on the carousel*/
.carousel-button {
position: absolute;
padding: 0 .25rem;
z-index: 2;
background: none;
background-color: rgba(0, 0, 0, .1);
border: none;
border-radius: .25rem;
font-size: 2.5rem;
top: 50%;
transform: translateY(-120%);
color: rgba(255, 255, 255, .5);
cursor: pointer;
}
.carousel-button:hover, .carousel-button:focus {
color: white;
background-color: rgba(0, 0, 0, .2);
}
.carousel-button:focus {
outline: 1px solid black;
}
.carousel-button.prev {
left: 1rem;
}
.carousel-button.next {
right: 12rem;
}
/*Styling and formatting the next image effect for the image carousel*/
.slide {
position: absolute;
inset: 0;
opacity: 0;
object-fit: fill;
transition: 400ms opacity ease-in-out;
transition-delay: 200ms;
}
.slide > img {
display: inline-block;
width: 70%;
height: 80%;
border-radius: 10px;
object-fit: cover;
box-shadow: 0px 0px 30px rgba(0, 0, 0, 0.5);
}
.slide[data-active] {
opacity: 1;
z-index: 1;
transition-delay: 0ms;
}
In CSS #lang-dropdown-button:focus should set pointer-events: all in #router-list , but it seems it doesn't work. The anchor doesn't navigate to the German on the dropdown. Why is that so?
*{
margin: 0px;
padding: 0px;
border:none;
}
body {
background-image: url(assets/bg.png);
background-repeat: no-repeat;
background-attachment: fixed;
}
#header {
width: 94%;
height: 50px;
border-radius: 34px;
margin: 35px 3% 0px;
background-color: rgb(255, 255, 255);
display: flex;
justify-content: space-between;
background-size: cover;
filter: drop-shadow(0px 4px 20px rgba(0, 0, 0, 0.1));
position: relative;
z-index: 100;
}
#body {
width: 94%;
height: 1000px;
margin: 35px 3% 35px;
border-radius: 25px;
background-color: rgb(255, 255, 255);
filter: drop-shadow(0px 4px 20px rgba(0, 0, 0, 0.1));
}
#logo {
align-self: center;
height: 70px;
width: 70px;
border-radius: 14px;
background-size: cover;
cursor: pointer;
}
#cont1 {
display: flex;
align-self: center;
}
#cont2 {
align-self: center;
}
#lang-dropdown {
height: fit-content;
width: fit-content;
flex-direction: column;
display: flex;
margin-right: 20px;
border-radius: 15px;
}
#elipse {
height: 10px;
width: 10px;
border-radius: 100%;
align-self: center;
background-color: #333333;
}
#title {
align-self: center;
margin-left: 10px;
display: flex;
flex-direction: row;
}
#privacy {
margin-left: 14px;
font-family: Ubuntu-Md;
font-style: normal;
line-height: 1;
font-size: 18px;
position: absolute;
align-self: center;
color: #333333;
}
#lang {
font-family: Ubuntu-Md;
font-style: normal;
font-weight: normal;
font-size: 16px;
line-height: 21px;
align-self: center;
color: #333333;
}
#text-container {
padding: 0px;
}
#policy-date {
font-family: Ubuntu;
font-style: normal;
font-weight: normal;
font-size: 16px;
line-height: 21px;
align-self: center;
color: #838383;
margin-top: 10px;
padding-left: 3.5%;
padding-bottom: 10px;
}
#text1 {
font-family: Ubuntu-Md;
font-style: normal;
font-weight: bold;
font-size: 28px;
align-self: center;
color: #333333;
padding: 3% 3% 0px;
}
#body-header {
width: 100%;
/* border-bottom: #d6d6d6 solid 1px; */
}
#globe {
color: #333333;
margin-left: 3px;
width: 25px;
height: 25px;
}
#arrow {
color: #333333;
margin-left: 1px;
margin-top: 1px;
align-self: center;
}
#lang-dropdown-button {
height: fit-content;
width: fit-content;
justify-content: space-around;
flex-direction: row;
display: flex;
background-color: rgba(255, 255, 255, 0);
cursor: pointer;
border-radius: 15px;
transition: all 0.6s ease;
width: 110px;
}
#router-list ul {
position: absolute;
background-color: #E7E7E7;
display: flex;
justify-content: space-around;
flex-direction: column;
align-items: center;
height: 35px;
width: 110px;
border-radius: 0px 0px 15px 15px;
}
#router-list li {
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
transition: all 0.4s ease;
}
#last {
border-radius: 0px 0px 15px 15px;
}
#router-list {
position: relative;
z-index: 50;
opacity: 0;
transform: translateY(-10px);
transition: all 0.4s ease;
pointer-events: none;
}
#last #lang-btn {
padding-bottom: 8px;
}
#router-list li:hover {
background-color: #d4d1d1;
border-radius: 0px;
}
#router-list #last:hover {
background-color: #d4d1d1;
border-radius: inherit;
}
/* #lang-dropdown-button:focus + #lang-dropdown{
border-radius: 15px 15px 0px 0px;
} */
#lang-dropdown-button:focus {
outline: none;
background-color: #E7E7E7;
border-radius: 15px 15px 0px 0px;
}
#lang-dropdown-button:focus + #router-list {
opacity: 1;
pointer-events: all;
z-index: 200;
transform: translateY(0px);
}
#lang-dropdown-button:hover{
background-color: #d4d1d1;
}
#lang-btn {
background-color: rgba(255, 255, 255, 0);
width: 100%;
height: 100%;
font-family: Ubuntu-Md;
font-style: normal;
font-weight: normal;
font-size: 16px;
line-height: 21px;
text-decoration: none;
color: #333333;
display: flex;
justify-content: center;
align-items: center;
}
#lang-btn:hover {
cursor: pointer;
}
#font-face {
font-family: "Ubuntu-md";
src: url("assets/Ubuntu-Medium.ttf");
}
#font-face {
font-family: "Ubuntu";
src: url("assets/Ubuntu-Regular.ttf");
}
#media only screen and (max-width: 370px){
#privacy {
margin-right: 127px;
font-size: 16px;
}
#text1 {
font-size: 24px;
}
}
#media only screen and (max-width: 620px){
#text1 {
padding: 5% 5% 0px;
}
#policy-date {
padding: 0% 6% 10px;
}
}
#media only screen and (max-width: 325px){
#text1 {
padding: 6% 6% 0px;
}
#policy-date {
padding: 0% 7% 10px;
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="style_v2.css" rel="stylesheet"/>
<title>Document</title>
</head>
<body>
<div id="header">
<div id="cont1">
<img id="logo" src="assets/logo.png" >
<div id ="title"><div id="elipse"></div> <div id="privacy">Privacy Policy</div> </div>
</div>
<div id="cont2">
<div id="lang-dropdown">
<button id="lang-dropdown-button" data-toggle="dropdown" >
<img id="arrow" src="assets/keyboard_arrow_down-24px 1.svg"/>
<div id="lang">English</div>
<img id="globe" src="assets/globe-24px.svg"/>
</button>
<div id="router-list" >
<ul>
<li id="last">Deutsch</li>
</ul>
</div>
</div>
</div>
</div>
<div id="box"></div>
<div id="body">
<div id="text-container">
<div id="body-header">
<div id="text1">title</div>
<div id="policy-date">Effective Date: m d, y</div>
</div>
<div></div>
</div>
</div>
</body>
</html>
i believe it has something to do with the hierarchy of the css combinators
https://www.w3schools.com/css/css_combinators.asp
i couldn't get it work either.. maybe because the combinator is acting on the div... but the links are actually li's inside a ul. thats just a guess tho.
I did however find you a work around. Switch to visibility:hidden instead of pointer-events. i tested it in VS code
it solves your hidden link being clickable thing
#router-list {
position: relative;
top: 20px;
z-index: 50;
opacity: 0;
transform: translateY(-10px);
transition: all 0.4s ease;
visibility: hidden;
/* pointer-events: none; */
}
#lang-dropdown-button:focus + #router-list {
opacity: 1;
/* pointer-events: all; */
visibility: visible;
z-index: 200;
transform: translateY(0px);
}
Just Change the
pointer-events: none; to pointer-events: all;
When the screen width becomes less than 767, the menu turns into a burger and on IE it looks different.
The alignment of items with flex disappears (the burger button and the basket are pressed), I sin on the menu that is positioned with
using fixed (becomes fixed at the checkpoint), I think that on IE the menu still takes its
the place, because of which the alignment occurs with its consideration. If you comment out the menu, everything will be ok.
How to fix it?
enter image description here
header in static condition
enter image description here
<div class="header_body">
<a href="#">
<h1>ze<span>bra</span></h1>
</a>
<div class="wrap-align">
<nav class="header_menu">
<ul class="header_list">
<li>Home</li>
<li>Products</li>
<li>Shopping</li>
<li>Contact</li>
</ul>
</nav>
<div class="price">
<a href="#">
<img src="img/Shape1.png" alt="">
</a>
<span>$35.00</span>
<span>▼</span>
</div>
<div class="header_burger">
<span></span>
</div>
</div>
</div>
//css
.header_body {
position: relative;
display: flex;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
justify-content: space-between;
-webkit-box-pack: justify;
-webkit-justify-content: space-between;
-ms-flex-pack: justify;
height: 86px;
align-items: center;
-webkit-box-align: center;
-webkit-align-items: center;
-ms-flex-align: center;
> a {
text-decoration: none;
color: $colorWord_header;
position: relative;
z-index: 5;
display: inline-block;
margin-right: 40px;
}
a > h1 {
font-size: 38px;
font-family: "HelveticaNeueCyr-Bold";
text-transform: uppercase;
}
a > h1 > span {
color: $logo_color;
}
}
.wrap-align {
width: 650px;
display: flex;
justify-content: space-between;
align-items: center;
}
.header_burger {
display: none;
}
.header_menu {
// margin-right: 118px;
}
.header_list {
display: flex;
position: relative;
z-index: 2;
li {
list-style: none;
}
a {
text-decoration: none;
display: inline-block;
color: $colorWord_header;
font-size: 18px;
font-family: "HelveticaNeueCyr-Regular";
padding: 34px 15px;
transition: all 0.3s;
&:hover {
color: #fff;
background-color: $bgc_head;
}
}
}
.price {
position: relative;
z-index: 5;
a {
text-decoration: none;
}
img {
vertical-align: baseline;
}
a + span {
font-size: 24px;
font-family: "HelveticaNeueCyr-Regular";
color: rgb(157, 157, 157);
margin: 0 10px;
}
span + span {
font-size: 18px;
color: rgb(157, 157, 157);
vertical-align: super;
cursor: pointer;
}
}
//#media
.header {
.header_burger {
display: block;
position: relative;
width: 30px;
height: 20px;
position: relative;
z-index: 3;
}
.header_burger:before,
.header_burger:after {
content: "";
position: absolute;
background-color: black;
width: 100%;
height: 2px;
left: 0;
transition: all 0.3s;
}
.header_burger:before {
top: 0;
}
.header_burger:after {
bottom: 0;
}
.header_burger span {
position: absolute;
top: 9px;
left: 0;
background-color: black;
width: 100%;
height: 2px;
transition: all 0.3s;
}
.header_burger.active span {
transform: scale(0);
}
.header_burger.active:before {
transform: rotate(45deg);
top: 9px;
}
.header_burger.active:after {
transform: rotate(-45deg);
bottom: 9px;
}
.header_menu {
position: fixed;
top: -100%;
left: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgba(255, 255, 255, 0.941);
padding: 130px 0 0 0;
transition: all 0.4s;
z-index: 1;
}
.wrap-align {
width: 300px;
}
.header_menu.active {
top: 0;
}
.header_list {
margin: 0 0 0 20px;
display: block;
li {
// margin: 10px 0;
}
a {
padding: 10px 20px;
}
}
.price {
margin-right: -30%;
}
}
I am building a page and I have small bug here.I can't click and hover on my button (buttons in div slide with class btn).I think a problem is in z-index or in margin on some element. But I don't know how to solve that.
Here is a page: http://project.gmwebs.cz/ .
* {
box-sizing: border-box;
margin: 0;
padding: 0;
font-family: 'Cabin', sans-serif;
}
body {
background: url(img/background.jpg);
}
a {
text-decoration: none;
color: rgb(121, 0, 0);
}
h2 {
color: #F2F2F2;
}
/* Menu */
.kolecko{
width: 200px;
height: 100px;
background-color: #F2F2F2;
border-bottom-right-radius: 100px;
border-bottom-left-radius: 100px;
border: 10px solid rgb(121, 0, 0);
border-top: 0;
z-index: 3;
position: absolute;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
margin-top: 40px;
}
.logo {
width: 160px;
z-index: 4;
position: absolute;
}
.menu-container {
display: flex;
justify-content: center;
align-items: center;
position: relative;
}
nav {
height: 90px;
background-color: #F2F2F2;
border-bottom: 10px solid rgb(121, 0, 0);
display: flex;
flex-direction: column;
align-content: center;
justify-content: center;
}
nav ul {
display: flex;
flex-direction: row;
align-content: center;
justify-content: center;
margin: 0 100px;
}
nav ul li{
list-style-type: none;
padding: 0 20px;
text-transform: uppercase;
color: rgb(121, 0, 0);
font-size: 1.5rem;
}
nav ul li a:hover {
color: #000;
}
.toggle {
width: 100%;
padding: 15px 20px;
background: rgb(121, 0, 0);
text-align: right;
box-sizing: border-box;
color: #fff;
font-size: 2rem;
display: none;
}
.ul-list {
display: flex;
align-content: center;
justify-content: center;
flex-direction: row;
}
#link-menu {
margin-right: 10%;
}
#phone {
margin-left: 10%;
}
nav .ul-list .social-btn li:nth-child(1) {
padding-right: 0px;
}
nav .ul-list .social-btn li:nth-child(2) {
padding-left: 7px;
}
.social-btn {
display: flex;
justify-content: center;
align-content: center;
flex-direction: row;
}
i.fab.fa-facebook-square {
color: #3b5992;
}
i.fab.fa-instagram {
background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%);
-webkit-background-clip: text;
/* Also define standard property for compatibility */
background-clip: text;
-webkit-text-fill-color: transparent;
}
/* Slider */
.slider {
display: block;
height: 100%;
width: 100%;
z-index: -1;
background-color: #1f1f1f;
overflow: hidden;
position: absolute;
top: 0px;
right: 0px;
border-bottom: 10px solid rgb(121, 0, 0);
}
.slider > * {
position: absolute;
display: block;
width: 100%;
height: 100%;
background-color: #1f1f1f;
animation: slide 12s infinite;
overflow: hidden;
}
.slide:nth-child(1) {
left: 0%;
animation-delay: -1s;
background-image: url(img/slide1.jpg);
background-size: cover;
background-position: center;
}
.slide:nth-child(2) {
left: 100%;
animation-delay: 3s;
background-image: url(img/slide2.png);
background-size: cover;
background-position: center;
}
.slide:nth-child(3) {
left: 100%;
animation-delay: 7s;
background-image: url(img/slide3.jpg);
background-size: cover;
background-position: center;
}
.slide p {
font-size: 2rem;
text-align: center;
display: inline-block;
width: 100%;
margin-top: 350px;
color: rgb(121, 0, 0);
background: 0% 0% no-repeat padding-box;
opacity: 0.84;
backdrop-filter: blur(30px);
-webkit-backdrop-filter: blur(30px);
padding-top: 20px;
z-index: 4;
}
.slide p span {
font-size: 1.5rem;
color: #000;
}
.btn {
background-color:transparent;
border:3px solid rgb(121, 0, 0);;
display:inline-block;
cursor:pointer;
color:rgb(121, 0, 0);
font-size: 1.5rem;
padding:5px 30px;
text-decoration:none;
margin: 20px 0;
}
.btn:hover {
background-color:transparent;
color: #000;
border:3px solid #000;
}
.btn:active {
position:relative;
top:1px;
}
#keyframes slide {
0% { left: 100%; width: 100%; opacity: 1;}
6.667% { left: 0%;}
33.334% { left: 0%;}
40% { left: -100%; width: 100%; opacity: 1;}
40.0001% { left: -100%; width: 0%; opacity: 0;}
100% { left: 100%; width: 0%; opacity: 1;}
}
/* Prolog */
.prolog {
text-align: center;
color: #F2F2F2;
margin: 10%;
margin-bottom: 5%;
font-size: 1.2rem;
margin-top: 102.5vh;
}
.prolog p {
margin-top: 1rem;
}
/* Newslatters */
.newslatters {
display: flex;
align-content: center;
justify-content: center;
flex-direction: column;
text-align: center;
color: #F2F2F2;
}
.newslatters form {
display: flex;
flex-direction: column;
justify-content: center;
align-content: center;
text-align: center;
margin: 1% 35%;
margin-top: 0%;
color: #F2F2F2;
}
.newslatters p {
margin: 0.5% 0%;
font-size: 1.2rem;
}
.newslatters h2 {
font-size: 1.8rem;
}
.newslatters form input.email {
margin: 1% 0;
padding: 2% 0%;
text-align: center;
font-size: 1rem;
background-color: #F2F2F2;
}
.newslatters form input.email:active {
border: 3px solid #000;
}
.newslatters form input.submit {
margin: 1% 25%;
margin-top: 5%;
border: 3px solid rgb(121, 0, 0);
padding: 1.3% 0%;
text-align: center;
font-weight: bold;
background-color: #F2F2F2;
font-size: 1rem;
box-shadow: 5px 10px transparent;
}
.newslatters form input:hover {
border: 3px solid #000;
}
/* Footer */
footer {
border-top: 5px solid rgb(121, 0, 0);
margin-top: 2%;
}
footer .author {
padding: 0.8% 0;
text-align: center;
color: #F2F2F2;
}
footer .author a{
font-weight: bold;
color: #F2F2F2;
}
footer .author a:hover{
color: rgb(121, 0, 0);
}
i.fas.fa-heart {
color: rgb(121, 0, 0);
}
/* Media Query */
#media (max-width: 1440px) {
nav ul li{
font-size: 1.3rem;
}
nav ul {
margin: 0 50px;
}
}
#media (max-width: 1024px) {
nav ul {
margin: 0 10px;
}
nav ul li{
font-size: 1rem;
}
footer .author {
padding: 1.5% 0;
text-align: center;
color: #F2F2F2;
}
}
#media (max-width: 1023px) {
.toggle {
display: block;
}
.kolecko {
display: none;
}
.active {
display: block;
}
.ul-list {
display: flex;
align-content: center;
justify-content: center;
flex-direction: column;
margin-top: 0px;
padding-top: 0px;
}
#link-menu {
margin-right: 0%;
height: 280px;
padding-bottom: 0px;
}
#phone {
margin-left: 0%;
}
#phone li:nth-child(2) {
border-bottom: none;
padding-top: 20px;
}
#phone .social-btn li:nth-child(1) {
border-bottom: none;
padding-right: 7px;
}
#phone .social-btn li:nth-child(2){
border-bottom: none;
padding-top: 0px;
}
.social-btn {
display: flex;
justify-content: center;
align-content: center;
flex-direction: row;
}
.logo {
z-index: 1;
position: absolute;
top: -400px;
}
nav {
height: auto;
background-color: #F2F2F2;
border-bottom: 10px solid rgb(121, 0, 0);
z-index:1;
display: none;
flex-direction: column;
align-content: flex-end;
justify-content: flex-end;
align-items: center;
}
nav ul {
display: flex;
flex-direction: column;
align-content: flex-end;
justify-content: flex-end;
text-align: center;
margin: 0px 0px;
z-index: 1;
padding-bottom: 20px;
}
nav ul li{
list-style-type: none;
padding: 0px 0px;
text-transform: uppercase;
color: rgb(121, 0, 0);
font-size: 1.5rem;
line-height: 1.4;
border-bottom: 1px #000 solid;
}
nav ul li:nth-child(2) {
margin-right: 0%;
}
nav ul li:nth-child(3) {
margin-left: 0%;
}
.slide p {
margin-top: 250px;
}
.prolog {
font-size: 1rem;
}
.newslatters form {
margin: 1% 20%;
font-size: 1rem;
}
.newslatters p {
font-size: 1rem;
}
.newslatters form input.submit {
padding: 1.3% 2%;
}
}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.13.1/css/all.css" integrity="sha384-xxzQGERXS00kBmZW/6qxqJPyxW3UR0BPsL4c8ILaIWXva5kFi7TxkIIaMiKtqV1Q" crossorigin="anonymous">
<div class="toggle">
<i class="fa fa-bars menu" aria-hidden="true"></i>
</div>
<nav>
<div class="ul-list">
<ul id="link-menu">
<li><i class="fas fa-home"></i> Domů</li>
<li><i class="fas fa-car"></i> Pronájem</li>
<li><i class="fas fa-dollar-sign"></i> Prodej</li>
</ul>
<ul id="phone">
<li><i class="fas fa-mobile-alt"></i> Kontakt</li>
<li><i class="fas fa-phone-square-alt"></i> +420 123456789</li>
<div class="social-btn">
<li><i class="fab fa-facebook-square"></i></li>
<li><i class="fab fa-instagram"></i></li>
</div>
</ul>
</div>
</nav>
<div class="menu-container">
<div class="kolecko">
</div>
<img src="css/img/logo.png" class="logo">
</div>
<div class="container">
<div class="slider">
<div class="slide">
<p>MB A35 AMG 2019 AeroPacket <br><span>Můžeš mě mít již od 4999 Kč</span><br>Pronajmout</p>
</div>
<div class="slide">
<p>Audi A7 V6T 2017 <br><span>Můžeš mě mít již od 4999 Kč</span><br>Pronajmout</p>
</div>
<div class="slide">
<p>Audi A3 2017 <br><span>Můžeš mě mít již od 4999 Kč</span><br>Pronajmout</p>
</div>
</div>
<div class="prolog">
<h1>Overcars s.r.o. - Půjčovna a prodejna luxusních automobilů</h1>
<p>Jsme malá začínající firma se zaměřením na pronájem a prodej vozů. Půjčujeme od levných vozů až po vozy luxusní! Naše vozy jsou s pravidelným servisem a ve 100% stavu. Řídíme se motem náš zákazník náš pán. Dokážeme zprostředkovat pronájem i prodej vozidel na míru.</p>
</div>
<div class="newslatters">
<h2>Chceš vědět, co se u nás děje?</h2>
<p>Přihlaš se k odběru novinek!</p>
<form action="#">
<input type="email" placeholder="Email" class="email">
<input type="submit" value="Odebírat" class="submit">
</form>
</div>
</div>
<footer>
<div class="author">
<p>Build with <i class="fas fa-heart"></i> by GMWebs</p>
</div>
</footer>
Can somebody help me please?
Thank you in advance for the advice!
It is definitely an issue with z-index.
You can simply add this CSS to your nav:
position: relative;
z-index: 1;
And remove the z-index: -1 from the .slider element.
I have a question about my responsive website.
I deployed my project to web server. In my local server and PC web server, I checked in google chrome dev tool, and z-index worked properly. The menu bar slides from the left side to the right side.
But when I checked in the real browser from a smartphone, the menu field did not show up. Background color and letter color are invisible.
When I tap each a tags (tags are invisible but I guessed each position.), I could jump to each page such as a result page, login page, and homepage. So I guess the menu bar is at the top of the screen.
The question is that,
when I see a responsive website, the menu bar doesn't appear and is
invisible. But a tags inside the menu are working properly so, I
cannot figure out what this problem is coming from.
.logo {
line-height: 50px;
float: left;
text-transform: uppercase;
color: #fff;
}
.header {
height: 50px;
background: #2D2524;
padding: 0 20px;
color: white;
position: -webkit-sticky;
position: sticky;
top: 0;
z-index: 1000;
}
.header2 {
display: none;
}
.menu {
float: right;
line-height: 50px;
}
.menu a {
color: #fff;
text-transform: uppercase;
text-decoration: none;
padding: 0 10px;
-webkit-transition: 0.4s;
transition: 0.4s;
}
.background-img {
background: url("../LPImages/karina-lago-wEucG_sLRsY-unsplash.jpg");
background-size: 100%;
background-size: cover;
background-repeat: no-repeat;
background-position: center center;
width: 100%;
position: relative;
height: 70vh;
}
.main_search {
position: absolute;
top: 70%;
left: 50%;
-webkit-transform: translateY(-50%) translateX(-50%);
transform: translateY(-50%) translateX(-50%);
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
width: 70%;
text-align: center;
}
.search_text {
background: #232323;
opacity: 0.9;
padding-left: 10px;
border: solid 3px #fff;
font-size: 16px;
line-height: 30px;
width: 35%;
height: 3rem;
font-weight: 400;
color: #fff;
}
.search_text:focus {
outline: none;
}
.Genre {
color: #fff;
background: #232323;
opacity: 0.9;
border: solid 3px #fff;
padding-left: 5px;
font-size: 16px;
line-height: 30px;
width: 20%;
height: 3.4rem;
font-weight: 400;
text-transform: uppercase;
}
.Genre:focus {
outline: none;
}
.search_date {
background: #232323;
opacity: 0.8;
margin-right: 15px;
padding-left: 15px;
color: #fff;
border: solid 3px #fff;
font-size: 16px;
width: 20%;
font-weight: 400;
height: 3rem;
}
.search_date:focus {
outline: none;
}
.search_icon {
color: #fff;
}
.show-menu-btn, .hide-menu-btn {
-webkit-transition: 0.4s;
transition: 0.4s;
font-size: 20px;
cursor: pointer;
display: none;
}
.show-menu-btn {
float: right;
}
.show-menu-btn i {
line-height: 50px;
}
.menu a:hover,
.show-menu-btn:hover,
.hide-menu-btn:hover {
color: grey;
}
.paragrah {
height: 50%;
width: 30%;
color: white;
margin-left: 5em;
margin-top: 7em;
margin-bottom: 20em;
font-size: 20px;
background-color: rgba(0, 0, 0, 0.7);
text-align: justify;
}
#chk {
position: absolute;
visibility: hidden;
z-index: -1111;
}
/*.content {
padding: o 20px;
img {
width: 100%;
max-width: 700px;
margin: 20px 0;
}
}*/
#media screen and (max-width: 800px) {
.header {
display: none;
}
.search {
display: none;
}
.header2 {
display: block;
width: 100%;
max-width: 100%;
-webkit-box-shadow: none;
box-shadow: none;
position: fixed;
height: 50px;
background: #2D2524;
overflow: hidden;
z-index: 10;
}
.background-img {
width: 100%;
}
.main {
margin: 0 auto;
display: block;
height: 100%;
margin-top: 60px;
}
.mainInner {
display: table;
height: 100%;
width: 100%;
text-align: center;
}
.mainInner div {
display: table-cell;
vertical-align: middle;
font-size: 3em;
font-weight: bold;
letter-spacing: 1.25px;
}
#sidebarSearch {
position: relative;
height: 100%;
left: 0;
width: 100%;
margin-top: 50px;
-webkit-transform: translateX(1500px);
transform: translateX(1500px);
-webkit-transition: -webkit-transform 0.6s ease-in-out;
transition: -webkit-transform 0.6s ease-in-out;
transition: transform 0.6s ease-in-out;
transition: transform 0.6s ease-in-out, -webkit-transform 0.6s ease-in-out;
background: #000000;
color: #fff;
position: fixed;
text-align: center;
}
.sidebarIconSearch i {
color: #fff;
-webkit-transition: all 0.3s;
transition: all 0.3s;
-webkit-box-sizing: border-box;
box-sizing: border-box;
cursor: pointer;
position: absolute;
top: 16px;
right: 25px;
z-index: 99;
font-size: 20px;
}
input[type="checkbox"]:checked ~ #sidebarSearch {
-webkit-transform: translateX(0);
transform: translateX(0);
}
input[type="checkbox"]:checked ~ #sidebarSearch ~ .sidebarIconToggle {
display: none;
}
.openSidebarSearch {
float: right;
}
.search-title {
font-size: 20px;
font-weight: bold;
margin: 20px 0 10px;
}
.search_text {
outline: none;
height: 30px;
width: 60%;
border: solid 3px #fff;
background: none;
border-radius: 30px;
color: #fff;
padding: 0 20px;
font-size: 16px;
}
.tag-list {
color: #000000;
margin: 0;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
list-style: none;
padding: 10px;
}
.tag-list li {
background: #fff;
border-radius: 30px;
margin: 4px;
height: 24px;
width: 80px;
-ms-flex-pack: distribute;
justify-content: space-around;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
font-size: 12px;
}
.Category dt {
background: #fff;
width: 80px;
height: 80px;
border-radius: 50%;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
}
.Category dt img {
width: 50px;
height: 50px;
}
.Category dd {
text-transform: uppercase;
font-weight: bold;
margin: 0 auto;
}
.Category-list {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: space-evenly;
-ms-flex-pack: space-evenly;
justify-content: space-evenly;
}
.Day-box {
outline: none;
height: 30px;
width: 200px;
border: solid 3px #fff;
background: none;
border-radius: 30px;
color: #fff;
padding: 0 20px;
font-size: 16px;
}
#sidebarMenu {
position: relative;
width: 100%;
height: 100%;
position: fixed;
left: 0;
margin-top: 50px;
-webkit-transform: translateX(-1500px);
transform: translateX(-1500px);
-webkit-transition: -webkit-transform 0.6s ease-in-out;
transition: -webkit-transform 0.6s ease-in-out;
transition: transform 0.6s ease-in-out;
transition: transform 0.6s ease-in-out, -webkit-transform 0.6s ease-in-out;
background: #000000;
}
.sidebarMenuInner {
position: absolute;
text-align: center;
top: 40%;
left: 50%;
-webkit-transform: translateY(-50%) translateX(-50%);
transform: translateY(-50%) translateX(-50%);
margin: 0;
padding: 0;
}
.sidebarMenuInner li {
list-style: none;
color: #fff;
text-transform: uppercase;
font-weight: bold;
font-size: 20px;
padding: 30px;
cursor: pointer;
}
.sidebarMenuInner li a {
color: #fff;
text-transform: uppercase;
font-weight: bold;
cursor: pointer;
text-decoration: none;
}
input[type="checkbox"]:checked ~ #sidebarMenu {
-webkit-transform: translateX(0);
transform: translateX(0);
}
input[type="checkbox"]:checked ~ #sidebarMenu ~ .sidebarIconSearch {
display: none;
}
input[type="checkbox"]:checked ~ #sidebarMenu ~ #sidebarSearch {
display: none;
}
input[type=checkbox] {
-webkit-transition: all 0.3s;
transition: all 0.3s;
-webkit-box-sizing: border-box;
box-sizing: border-box;
display: none;
}
.sidebarIconToggle {
-webkit-transition: all 0.3s;
transition: all 0.3s;
-webkit-box-sizing: border-box;
box-sizing: border-box;
cursor: pointer;
position: absolute;
z-index: 99;
height: 100%;
width: 100%;
top: 18px;
left: 20px;
height: 22px;
width: 22px;
}
.spinner {
-webkit-transition: all 0.3s;
transition: all 0.3s;
-webkit-box-sizing: border-box;
box-sizing: border-box;
position: absolute;
height: 3px;
width: 100%;
background-color: #fff;
}
.horizontal {
-webkit-transition: all 0.3s;
transition: all 0.3s;
-webkit-box-sizing: border-box;
box-sizing: border-box;
position: relative;
float: left;
margin-top: 3px;
}
.diagonal.part-1 {
position: relative;
-webkit-transition: all 0.3s;
transition: all 0.3s;
-webkit-box-sizing: border-box;
box-sizing: border-box;
float: left;
}
.diagonal.part-2 {
-webkit-transition: all 0.3s;
transition: all 0.3s;
-webkit-box-sizing: border-box;
box-sizing: border-box;
position: relative;
float: left;
margin-top: 3px;
}
input[type=checkbox]:checked ~ .sidebarIconToggle > .horizontal {
-webkit-transition: all 0.3s;
transition: all 0.3s;
-webkit-box-sizing: border-box;
box-sizing: border-box;
opacity: 0;
}
input[type=checkbox]:checked ~ .sidebarIconToggle > .diagonal.part-1 {
-webkit-transition: all 0.3s;
transition: all 0.3s;
-webkit-box-sizing: border-box;
box-sizing: border-box;
-webkit-transform: rotate(135deg);
transform: rotate(135deg);
margin-top: 8px;
}
input[type=checkbox]:checked ~ .sidebarIconToggle > .diagonal.part-2 {
-webkit-transition: all 0.3s;
transition: all 0.3s;
-webkit-box-sizing: border-box;
box-sizing: border-box;
-webkit-transform: rotate(-135deg);
transform: rotate(-135deg);
margin-top: -9px;
}
}
.image img {
border: 1px solid white;
}
.event-name {
font-size: 20px;
color: white;
}
.heart {
margin-top: -20px;
margin-left: 17rem;
}
.event-date {
font-size: 20px;
color: #FD8700;
}
.card-info {
color: white;
font-size: 18px;
}
.save-mark {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
}
.button {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
width: 300px;
margin-left: 120px;
}
.seemore-btn {
margin-top: 4rem;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
}
.seemore-btn a {
color: white;
border-radius: 30px;
font-size: 24px;
padding: 4px 20px 4px 20px;
border: 0;
cursor: pointer;
text-decoration: none;
background: #7206F7;
}
.category-container {
margin-top: 8rem;
}
.category-card {
padding: 0 50px 80px;
margin: 0 auto;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
text-align: center;
-webkit-box-pack: space-evenly;
-ms-flex-pack: space-evenly;
justify-content: space-evenly;
}
.category-card p {
text-transform: uppercase;
margin-top: 20px;
color: #ffffff;
font-size: 35px;
}
.category-image {
overflow: hidden;
border-radius: 50%;
width: 220px;
height: 220px;
border: solid #ffffff 1px;
}
.category-image img {
width: 220px;
height: 220px;
-o-object-fit: cover;
object-fit: cover;
border-radius: 50%;
-webkit-transition-duration: 0.5s;
transition-duration: 0.5s;
-webkit-transform: scale(1);
transform: scale(1);
}
.category-image img:hover {
-webkit-transform: scale(1.1, 1.1);
transform: scale(1.1, 1.1);
}
#media screen and (max-width: 800px) {
.category-card {
display: block;
}
.category-card-content {
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
margin-bottom: 70px;
position: relative;
}
.category-card-content p {
position: absolute;
top: 43%;
left: 50%;
-webkit-transform: translateY(-50%) translateX(-50%);
transform: translateY(-50%) translateX(-50%);
font-size: 45px;
}
.category-image {
margin: 0 auto;
border: solid 1px #ffffff;
}
.category-image img {
opacity: 0.7;
}
}
.use_contents {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.use_contents img {
margin-right: 7rem;
width: 20%;
}
.Description {
text-align: center;
width: 30%;
}
.Description p {
text-align: center;
font-size: 19px;
margin-top: 0.5rem;
color: #c7c7c7;
}
.register-btn {
margin-top: 4rem;
}
.register-btn a {
background-color: #F70661;
text-decoration: none;
color: white;
margin-top: 10px;
border-radius: 30px;
font-size: 24px;
padding: 4px 20px 4px 20px;
border: 0;
cursor: pointer;
}
.find_func {
margin: 1rem;
}
.use_contents2 img {
margin-left: 7rem;
margin-right: 0;
}
.start {
margin: 4rem 0 10rem;
text-align: center;
}
.right {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
margin: 0 0 0 auto;
}
#media screen and (max-width: 800px) {
.use_contents {
padding: 20px;
}
.use_contents img {
margin-right: 1rem;
width: 40%;
}
.use_contents2 {
margin-left: 0;
}
.use_contents2 img {
margin-right: 0;
margin-left: 1rem;
}
.Description {
width: 100%;
}
h4 {
margin: 0;
}
}
.login {
background: url("../LPImages/danny-howe-bn-D2bCvpik-unsplash.jpg");
background-size: 100%;
background-size: cover;
background-repeat: no-repeat;
background-position: center center;
width: 100%;
position: relative;
height: 80vh;
}
.login-contents {
background: rgba(0, 0, 0, 0.4);
height: 80vh;
width: 100%;
text-align: center;
}
.login-base {
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translateY(-50%) translateX(-50%);
transform: translateY(-50%) translateX(-50%);
}
.login-base h2 {
margin: 0;
}
.login-erea p {
font-size: 18px;
color: white;
}
.login-box {
margin: 12px 0;
padding: 0 20px;
font-size: 12px;
color: #fff;
background: none;
border-radius: 30px;
height: 2.3em;
width: 25em;
outline: none;
border: #fff solid 3px;
}
.login-link {
margin-top: 2.5rem;
}
.login-link a {
background-color: #0FCC41;
color: white;
margin-top: 10px;
border-radius: 30px;
font-size: 24px;
padding: 4px 38px 4px 38px;
border: 0;
cursor: pointer;
text-decoration: none;
}
.forgot {
margin-top: 0.8rem;
}
.forgot a {
font-size: 18px;
color: white;
text-decoration: none;
border-bottom: 0.5px solid white;
}
.sns-icon-erea {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
margin: 2rem 0 0.5rem;
}
.sns-icon {
position: relative;
height: 50px;
width: 50px;
border-radius: 50%;
margin: 0 10px;
cursor: pointer;
}
.sns-icon i {
color: #fff;
position: absolute;
top: 50%;
left: 52%;
-webkit-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
}
.footer {
height: 50vh;
width: 100%;
background-color: #2D2524;
}
/*#import "./footer";*/
* {
margin: 0;
padding: 0;
font-family: 'Josefin Sans', sans-serif;
font-weight: 100;
}
body {
background-color: black;
}
h2 {
color: white;
text-align: center;
margin-bottom: 3rem;
font-size: 38px;
}
h3 {
color: white;
font-size: 33px;
}
h4 {
color: white;
font-size: 23px;
margin-top: 2rem;
}
.face {
background: #305097;
}
.twi {
background: #00aced;
}
.goo {
background: #db4a39;
}
/*# sourceMappingURL=main.css.map */
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link href="https://use.fontawesome.com/releases/v5.6.1/css/all.css" rel="stylesheet">
<link rel="stylesheet" href="../css/main.css">
<link rel="stylesheet" href="https://unpkg.com/swiper/css/swiper.css">
<link rel="stylesheet" href="../css/swiper.css">
<link href="https://fonts.googleapis.com/css?family=Lato&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Josefin+Sans&display=swap" rel="stylesheet">
<title>landing page</title>
</head>
<body>
<div class="header">
<h1 class="logo">Dark Code</h1>
<input type="checkbox" id="chk">
<label for="chk" class="show-menu-btn">
<i class="fas fa-bars" style="color: white;"></i>
</label>
<ul class="menu">
<div class="menu-list">
Register
Events
Login
<label for="chk" class="hide-menu-btn">
<i class="fas fa-times" style="color: white;"></i>
</label>
</div>
</ul>
</div>
<div class="header2">
<input type="checkbox" class="openSidebarMenu" id="openSidebarMenu">
<label for="openSidebarMenu" class="sidebarIconToggle">
<div class="spinner diagonal part-1"></div>
<div class="spinner horizontal"></div>
<div class="spinner diagonal part-2"></div>
</label>
<div id="sidebarMenu">
<ul class="sidebarMenuInner">
<li>Home</li>
<li>Events</li>
<li>Profile</li>
<li>Log out</li>
</ul>
</div>
<input type="checkbox" class="openSidebarSearch" id="openSidebarSearch">
<label for="openSidebarSearch" class="sidebarIconSearch">
<i class="fas fa-search search_icon"></i>
</label>
<div id="sidebarSearch">
<div class="search-erea">
<div class="search-title">Enter the name of event</div>
<input type="text" class="search_text">
<div class="search-title">Choose tags</div>
<ul class="tag-list">
<li>Tag</li>
<li>Tag</li>
<li>Tag</li>
<li>Tag</li>
</ul>
<ul class="tag-list">
<li>Tag</li>
<li>Tag</li>
<li>Tag</li>
<li>Tag</li>
</ul>
</div>
<div class="search-erea">
<div class="search-title">Categorys</div>
<div class="Category-list">
<dl class="Category">
<dt><img src="./image/martini.png" alt="bar-img"></dt>
<dd>bar</dd>
</dl>
<dl class="Category">
<dt><img src="./image/beer.png" alt="pub-img"></dt>
<dd>pub</dd>
</dl>
<dl class="Category">
<dt><img src="./image/dj.png" alt="club-img"></dt>
<dd>club</dd>
</dl>
</div>
</div>
<div class="search-erea">
<div class="search-title">Day</div>
<input type="text" class="Day-box">
</div>
</div>
</div>
<div class="background-img">
<div class="main_search">
<div class="search_content">
<form action="#" class="search">
<input type="text" class="search_text" placeholder="Enter the key words !">
<select name="select" id="select" class="Genre">
<option value="" hidden">genre</option>
<option value="1">bar</option>
<option value="2">pub</option>
<option value="3">club</option>
</select>
<input type="date" class="search_date">
<i class="fas fa-search search_icon"></i>
</div>
</div>
</div>
<script src="https://unpkg.com/swiper/js/swiper.js"></script>
<script src="https://unpkg.com/swiper/js/swiper.min.js"></script>
<script src="./js/swiper.min.js"></script>
<script>
var mySwiper = new Swiper ('.swiper-container', {
// Optional parameters
direction: 'horizontal',
slidesPerView: 4,
spaceBetween: 10,
centeredSlides : true,
loop: true,
// Navigation arrows
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
})
</script>
</body>
</html>
From a smartphone, it doesn't work, but if you check from PC, it works so I hope you can check this link from a smartphone.
thank you.
I checked both iOS and Android chrome browser.
And this issue is happening only in iOS.
So please check by iPhone.
I also experience this issue on iOS devices time to time.
z-index behaves different on iOS (no matter the browser). Even if you correctly index content on Z axis, it won't be shown correctly on iOS devices.
Workaround is, giving container div a higher z-index than background.
In your case #sidebarMenu {z-index: 100;} should work.
This looks like it might be an issue with iOS.
According to the specs, the CSS property z-index should only not work if an element has the default positioning:
position: static
Consequently, to ensure that z-index works, any of the following may be applied to the element (which we can see you're already doing):
position: relative
position: absolute
position: fixed
position: sticky
Further Reading:
position: static
The element is positioned according to the normal flow of the document. The top, right, bottom, left, and z-index properties have no
effect. This is the default value.
Source: https://developer.mozilla.org/en-US/docs/Web/CSS/position#values