.wrap {
background-color: #393939;
height: inherit;
}
/*-----------------------header---------------------------------------------------------*/
.header-inner {
background-color: #393939;
width: 100%;
height: 70px;
/* [disabled]display: flex; */
position: fixed;
top: 0;
}
.pclogo {
display: none;
}
.tabletlogo {
display: none;
}
.line {
display: none;
}
a .mobilelogo {
width: 215px;
height: auto;
margin-top: 10px;
display: block;
margin-right: auto;
margin-left: auto;
cursor: pointer;
}
/*doesn't show the navigation bar*/
.navbar {
display: none
}
/*---------------------hamburger-----------------------*/
.hamburger {
display: block;
position: absolute;
top: 10px;
right: 3.3%;
cursor: pointer;
float: right;
z-index: 4/*important!!! humburger menu comes on the top of side menu*/
}
.bar1,
.bar2,
.bar3 {
width: 26px;
height: 3px;
/* Original 5px*/
margin: 8px 0;
/* Original 6px*/
transition: 0.6s;
background-color: white;
border-radius: 3px;
}
/* Rotate first bar */
.change .bar1 {
-webkit-transform: translate(0px, 5.5px) rotate(-45deg);
/*move →0px ↓5.5px(hight of bar/2+margin/2) and lotate ↺45°*/
transform: translate(0px, 5.5px) rotate(-45deg);
background-color: rgba(207, 207, 207, 1.00);
}
/* Fade out the second bar */
/*.change .bar2 {
opacity: 0;
}*/
/* Rotate last bar */
.change .bar3 {
-webkit-transform: translate(0px, -5.5px) rotate(45deg);
transform: translate(0px, -5.5px) rotate(45deg);
background-color: rgba(207, 207, 207, 1.00);
}
/*---dropdown menu---*/
.dropdown {
height: 100%;
width: 0;
position: fixed;
z-index: 3;
/*important!!! humburger menu comes on the top of side menu*/
top: 0;
right: 0;
background-color: #393939;
overflow-x: hidden;
transition: 0.5s;
padding-top: 60px;
text-align: center;
}
.dropdown a {
display: none;
transition: 0.4s;
}
/*---dropdown menu withdraw---*/
.change.dropdown {
height: 100%;
width: 50%;
position: fixed;
z-index: 3;
top: 0;
right: 0;
background-color: rgba(69, 69, 69, 0.90);
/*Color Transparency of side menu*/
overflow-x: hidden;
transition: 0.6s;
padding: 68px 0 0 0;
/* control the space above "Home"*/
text-align: center;
}
/*---dropdown menu effect---*/
.change.dropdown a {
padding: 10px 5px;
font-family: 'Kozuka Gothic Pr6N';
font-size: 18px;
text-decoration: none;
color: white;
display: block;
transition: 0.3s;
border-bottom: rgba(163, 161, 161, 0.77);
}
.dropdown a::before {
-webkit-transition-duration: 0.3s;
/* Safari */
transition-duration: 0.3s;
content: attr(data-hover);
/*The attr() property inserts a specified attribute's value before or after the selected element(s).*/
}
.dropdown a:hover {
border-left: 2px solid rgba(255, 255, 255, 0.70);
border-right: 2px solid rgba(255, 255, 255, 0.70);
-webkit-transform: scale(0.9);
-moz-transform: scale(0.9);
transform: scale(0.9);
color: rgba(255, 255, 255, 0.70);
}
/*---------------------hamburger---------------------------*/
/*---------------------------------------------header----------------------------------------------*/
/*----------------------------------------------Main----------------------------------------------*/
.main-inner {
min-height: 100%;
height: auto !important;
/*Cause footer to stick to bottom in IE 6*/
height: 100%;
vertical-align: bottom;
padding-top: 70px;
/*-------important!!!!!-------*/
}
.slideimage-container img {
height: inherit;
width: 100%;
/* [disabled]padding-top: 90px; */
/* [disabled]padding-bottom: 70px; */
object-fit: cover;
object-position: center;
overflow: hidden;
}
/*----------update list-----------*/
.update-container {
padding: 5px;
width: 100%;
}
.update-container table {
margin: 0 auto;
}
.update-container table tr {
color: white;
font-size: 10px;
font-family: 'Kozuka Gothic Pr6N';
text-align: left;
font-weight: thin;
padding: 5px 10px;
vertical-align: top;
}
/*----------------------------------------------Main----------------------------------------------*/
/*----------------------------------------------Footer----------------------------------------------*/
.footer-inner {
width: 100%;
/* [disabled]padding-top: 15px; */
/*space between Main and Footer*/
height: 28px;
bottom: 0;
position: fixed;
background-color: #393939;
z-index: 1;
}
.line-footer {
display: none;
/* [disabled]width: 100%; */
/* [disabled]height: 1px; */
/* [disabled]border-bottom: 1px solid white; */
/* [disabled]margin-bottom: 15px; */
/* [disabled]position: absolute; */
}
.copyright {
width: 100%;
float: right;
font-family: 'Kozuka Gothic Pr6N';
color: #ffffff;
font-size: 0.5px;
bottom: 0px;
padding: 10px 5px 0 0;
/* [disabled]margin-right: 5px; */
text-align: right;
/* [disabled]position: absolute; */
}
/*----------------------------------------------Footer----------------------------------------------*/
<body oncontextmenu="return false">
<div class="wrap">
<!-- to define the maximum width -->
<!-- Header -->
<header>
<div class="container">
<div class="header-inner">
<!-- Header Flex (logo and navbar) -->
<!-- Hamburger -->
<div class="hamburger" onclick="myFunction(this)">
<div class="bar1"></div>
<!-- <div class="bar2"></div> -->
<div class="bar3"></div>
</div>
<div id="myDIV" class="dropdown" role="navigation">
Home
News
Concept
Profile
Works
Contact
</div>
<!-- x is used to change hamburger menu, y is used to change side menu width -->
<script>
function myFunction(x) {
x.classList.toggle("change");
var y = document.getElementById("myDIV");
y.classList.toggle("change");
}
</script>
<!-- Hamburger -->
<ul class="navbar" role="navigation">
<li>Home</li>
<li>News</li>
<li>Concept</li>
<li>Profile</li>
<li>Works</li>
<li>Contact</li>
</ul>
<div class="line"></div>
</div>
</div>
</header>
<!-- Main Content -->
<main>
<div class="container">
<div class="main-inner">
</div>
</div>
<div class="container">
<div class="update-container">
</div>
</div>
</main>
<!-- End Main Content -->
<!-- Footer -->
<footer>
<div class="container">
<div class="footer-inner">
<div class="line-footer"></div>
<div class="copyright">
Copyright © 小野寺康都市設計事務所. All rights reserved.
</div>
</div>
</div>
</footer>
<!-- End Footer -->
</div>
</body>
z-index
show the footer on top of main contents under the side menu
.dropdown `{height: 100%;width: 0;position: fixed;z-index: 3;/*important!!! humburger menu comes on the top of side menu*/top: 0;right: 0;background-color: #393939;overflow-x: hidden;transition: 0.5s;padding-top: 60px;text-align: center;}`
.hamburger `{display: block;position: absolute;top: 10px;right: 3.3%;cursor: pointer;float: right;z-index: 4/*important!!! humburger menu comes on the top of side menu*/}`
.footer-inner `{width: 100%;/* [disabled]padding-top: 15px; *//*space between Main and Footer*/height: 28px;bottom: 0;position: fixed;background-color: #393939;z-index: 1;}`
Footer(z-index:1) should be showed under the side menu(z-index:3) and hamburger(z-index:4).
If I changed z-index of footer to -1, it gets the desired result, but then footer comes behind the main contents...
I want to keep footer on top of main contents under the side menu.
z-index can be tricky because it is relative to the containing z-index. A z-index is calculated for any object that is positioned (meaning relative, absolute, fixed, or sticky).
Because .header-inner is fixed, it has a calculated z-index of 0. Now, because z-index is relative to the containing z-index, your .inner-footer's z-index is relative to z-index 0, so any z-index that is nested in .header-inner will not be able to be placed on top of a block that is on top of .header-inner unless you change .header-inner's z-index to a greater value.
This ultimately means that your .inner-footer's z-index of 1 is competing vs. a z-index of 0, so it will always be placed on top unless you change the competing z-index to a value greater than 1 (change it to 2).
To make it clearer that .hamburger and .change.dropdown have nested z-index values, you can change these to 2 and 1, respectively, and they will have the same effect as they do now.
See the modified code:
.wrap {
background-color: #393939;
height: inherit;
}
/*-----------------------header---------------------------------------------------------*/
.header-inner {
background-color: #393939;
width: 100%;
height: 70px;
/* [disabled]display: flex; */
position: fixed;
z-index: 2; /* to place this on top of footer */
top: 0;
}
.pclogo {
display: none;
}
.tabletlogo {
display: none;
}
.line {
display: none;
}
a .mobilelogo {
width: 215px;
height: auto;
margin-top: 10px;
display: block;
margin-right: auto;
margin-left: auto;
cursor: pointer;
}
/*doesn't show the navigation bar*/
.navbar {
display: none
}
/*---------------------hamburger-----------------------*/
.hamburger {
display: block;
position: absolute;
top: 10px;
right: 3.3%;
cursor: pointer;
float: right;
z-index: 2 /*important!!! humburger menu comes on the top of side menu*/
}
.bar1,
.bar2,
.bar3 {
width: 26px;
height: 3px;
/* Original 5px*/
margin: 8px 0;
/* Original 6px*/
transition: 0.6s;
background-color: white;
border-radius: 3px;
}
/* Rotate first bar */
.change .bar1 {
-webkit-transform: translate(0px, 5.5px) rotate(-45deg);
/*move →0px ↓5.5px(hight of bar/2+margin/2) and lotate ↺45°*/
transform: translate(0px, 5.5px) rotate(-45deg);
background-color: rgba(207, 207, 207, 1.00);
}
/* Fade out the second bar */
/*.change .bar2 {
opacity: 0;
}*/
/* Rotate last bar */
.change .bar3 {
-webkit-transform: translate(0px, -5.5px) rotate(45deg);
transform: translate(0px, -5.5px) rotate(45deg);
background-color: rgba(207, 207, 207, 1.00);
}
/*---dropdown menu---*/
.dropdown {
height: 100%;
width: 0;
position: fixed;
z-index: 3;
/*important!!! humburger menu comes on the top of side menu*/
top: 0;
right: 0;
background-color: #393939;
overflow-x: hidden;
transition: 0.5s;
padding-top: 60px;
text-align: center;
}
.dropdown a {
display: none;
transition: 0.4s;
}
/*---dropdown menu withdraw---*/
.change.dropdown {
height: 100%;
width: 50%;
position: fixed;
z-index: 1; /* below hamburger */
top: 0;
right: 0;
background-color: rgba(69, 69, 69, 0.90);
/*Color Transparency of side menu*/
overflow-x: hidden;
transition: 0.6s;
padding: 68px 0 0 0;
/* control the space above "Home"*/
text-align: center;
}
/*---dropdown menu effect---*/
.change.dropdown a {
padding: 10px 5px;
font-family: 'Kozuka Gothic Pr6N';
font-size: 18px;
text-decoration: none;
color: white;
display: block;
transition: 0.3s;
border-bottom: rgba(163, 161, 161, 0.77);
}
.dropdown a::before {
-webkit-transition-duration: 0.3s;
/* Safari */
transition-duration: 0.3s;
content: attr(data-hover);
/*The attr() property inserts a specified attribute's value before or after the selected element(s).*/
}
.dropdown a:hover {
border-left: 2px solid rgba(255, 255, 255, 0.70);
border-right: 2px solid rgba(255, 255, 255, 0.70);
-webkit-transform: scale(0.9);
-moz-transform: scale(0.9);
transform: scale(0.9);
color: rgba(255, 255, 255, 0.70);
}
/*---------------------hamburger---------------------------*/
/*---------------------------------------------header----------------------------------------------*/
/*----------------------------------------------Main----------------------------------------------*/
.main-inner {
min-height: 100%;
height: auto !important;
/*Cause footer to stick to bottom in IE 6*/
height: 100%;
vertical-align: bottom;
padding-top: 70px;
/*-------important!!!!!-------*/
}
.slideimage-container img {
height: inherit;
width: 100%;
/* [disabled]padding-top: 90px; */
/* [disabled]padding-bottom: 70px; */
object-fit: cover;
object-position: center;
overflow: hidden;
}
/*----------update list-----------*/
.update-container {
padding: 5px;
width: 100%;
}
.update-container table {
margin: 0 auto;
}
.update-container table tr {
color: white;
font-size: 10px;
font-family: 'Kozuka Gothic Pr6N';
text-align: left;
font-weight: thin;
padding: 5px 10px;
vertical-align: top;
}
/*----------------------------------------------Main----------------------------------------------*/
/*----------------------------------------------Footer----------------------------------------------*/
.footer-inner {
width: 100%;
/* [disabled]padding-top: 15px; */
/*space between Main and Footer*/
height: 28px;
bottom: 0;
position: fixed;
background-color: #393939;
z-index: 1;
}
.line-footer {
display: none;
/* [disabled]width: 100%; */
/* [disabled]height: 1px; */
/* [disabled]border-bottom: 1px solid white; */
/* [disabled]margin-bottom: 15px; */
/* [disabled]position: absolute; */
}
.copyright {
width: 100%;
float: right;
font-family: 'Kozuka Gothic Pr6N';
color: #ffffff;
font-size: 0.5px;
bottom: 0px;
padding: 10px 5px 0 0;
/* [disabled]margin-right: 5px; */
text-align: right;
/* [disabled]position: absolute; */
}
<body oncontextmenu="return false">
<div class="wrap">
<!-- to define the maximum width -->
<!-- Header -->
<header>
<div class="container">
<div class="header-inner">
<!-- Header Flex (logo and navbar) -->
<!-- Hamburger -->
<div class="hamburger" onclick="myFunction(this)">
<div class="bar1"></div>
<!-- <div class="bar2"></div> -->
<div class="bar3"></div>
</div>
<div id="myDIV" class="dropdown" role="navigation">
Home
News
Concept
Profile
Works
Contact
</div>
<!-- x is used to change hamburger menu, y is used to change side menu width -->
<script>
function myFunction(x) {
x.classList.toggle("change");
var y = document.getElementById("myDIV");
y.classList.toggle("change");
}
</script>
<!-- Hamburger -->
<ul class="navbar" role="navigation">
<li>Home</li>
<li>News</li>
<li>Concept</li>
<li>Profile</li>
<li>Works</li>
<li>Contact</li>
</ul>
<div class="line"></div>
</div>
</div>
</header>
<!-- Main Content -->
<main>
<div class="container">
<div class="main-inner">
</div>
</div>
<div class="container">
<div class="update-container">
</div>
</div>
</main>
<!-- End Main Content -->
<!-- Footer -->
<footer>
<div class="container">
<div class="footer-inner">
<div class="line-footer"></div>
<div class="copyright">
Copyright © 小野寺康都市設計事務所. All rights reserved.
</div>
</div>
</div>
</footer>
<!-- End Footer -->
</div>
</body>
Try adding z-index:2 to your .header-inner class and see if you get the desired result.
Related
I'm trying to create a hover effect where words appear over the hero section when the mouse hovers over it. If you uncomment the code at the bottom of the CSS file you will see that the code works just fine. The only problem is the backround picture dispears and turns completely white. I don't know how to fix it.
Uncomment the code all the way at the bottom of the CSS to see what I'm talking about
* {
box-sizing: border-box;
margin: 0;
padding: 0;
font-family: "Kumbh Sans", sans-serif;
scroll-behavior: smooth;
}
.navbar {
background: #131313;
height: 60px;
display: flex;
justify-content: center;
align-items: center;
font-size: 1.2rem;
position: sticky;
top: 0;
z-index: 555;
}
.navbar__container {
display: flex;
justify-content: space-between;
height: 80px;
z-index: 1;
width: 100%;
max-width: 1300px;
margin: 0 auto;
padding: 0 20px;
}
#navbar__logo {
background-color: #ff8d02;
-webkit-background-clip: text;
-moz-background-clip: text;
-webkit-text-fill-color: transparent;
-moz-text-fill-color: transparent;
display: flex;
align-items: center;
cursor: pointer;
text-decoration: none;
font-size: 2rem;
}
#trade {
background-color: #0045f2;
-webkit-background-clip: text;
-moz-background-clip: text;
-webkit-text-fill-color: transparent;
-moz-text-fill-color: transparent;
display: flex;
position: relative;
font-size: 13px;
bottom: 6px;
}
.navbar__menu {
display: flex;
align-items: center;
list-style: none;
}
.navbar__item {
height: 80px;
}
.navbar__links {
color: #fff;
display: flex;
align-items: center;
justify-content: center;
width: 120px;
text-decoration: none;
height: 100%;
transition: all 0.3s ease;
}
.navbar__btn {
display: flex;
justify-content: center;
align-items: center;
padding: 0 1rem;
width: 100%;
}
.button {
display: flex;
justify-content: center;
align-items: center;
text-decoration: none;
padding: 10px 20px;
height: 100%;
width: 100%;
border: none;
outline: none;
border-radius: 4px;
background: #833ab4;
background: -webkit-linear-gradient(to right, rgb(240, 105, 2), #8c8393, #4d7fff);
background: linear-gradient(to right, rgb(240, 105, 2), #8c8393, #4d7fff);
color: #fff;
transition: all 0.3s ease;
}
.navbar__btn:after {
position: absolute;
content: '';
top: 0;
left: 0;
width: 0;
height: 100%;
border-radius: 4px;
transition: all 1s ease;
}
.navbar__links:hover {
color: #ff7802;
transition: all 0.3s ease;
}
#media screen and (max-width: 960px) {
.navbar__container {
display: flex;
justify-content: space-between;
height: 80px;
z-index: 1;
width: 100%;
max-width: 1300px;
padding: 0;
}
.navbar__menu {
display: grid;
grid-template-columns: auto;
margin: 0;
width: 100%;
position: absolute;
top: -1000px;
opacity: 1;
transition: all 0.5s ease;
z-index: -1;
}
.navbar__menu.active {
background: #131313;
top: 100%;
opacity: 1;
transition: all 0.5s ease;
z-index: 99;
height: 60vh;
font-size: 1.6rem;
}
#navbar__logo {
padding-left: 25px;
}
.navbar__toggle .bar {
width: 25px;
height: 3px;
margin: 5px auto;
transition: all 0.3s ease-in-out;
background: #fff;
}
.navbar__item {
width: 100%;
}
.navbar__links {
text-align: center;
padding: 2rem;
width: 100%;
display: table;
}
.navbar__btn {
padding-bottom: 2rem;
}
.button {
display: flex;
justify-content: center;
align-items: center;
width: 80%;
height: 80px;
margin: 0;
}
#mobile-menu {
position: absolute;
top: 20%;
right: 5%;
transform: translate(5%, 20%);
}
.navbar__toggle .bar {
display: block;
cursor: pointer;
}
#mobile-menu.is-active .bar:nth-child(2) {
opacity: 0;
}
#mobile-menu.is-active .bar:nth-child(1) {
transform: translateY(8px) rotate(45deg);
}
#mobile-menu.is-active .bar:nth-child(3) {
transform: translateY(-8px) rotate(-45deg);
}
}
/* Hero Section */
.hero {
padding: 50px 0;
background-image: url(./images/brooke-cagle-g1Kr4Ozfoac-unsplash.jpg);
background-size: cover;
overflow: hidden;
position: relative;
background-position: top;
display: flex;
flex-direction: column;
}
.hero__heading {
color: #fff;
font-size: 100px;
margin-left: 30px;
text-shadow: 2px 2px 8px #000000c4;
}
.orange {
color: rgb(255, 89, 0);
}
.main__btn {
margin: 0 auto;
margin-top: 3rem;
}
.main__btn a {
color: #fff;
text-decoration: none;
z-index: 2;
position: relative;
padding: 10px 20px;
font-size: 1.8rem;
}
.button__color {
background: -webkit-linear-gradient(to right, #1e5dff, rgb(255, 89, 0) );
background: linear-gradient(to right, #1e5dff, rgb(255, 89, 0));
}
/*
.hero_two {
position: relative;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.6);
color: #ffffff;
opacity: 0;
transition: all 0.25s ease;
}
.hero_two > * {
transform: translateY(20px);
transition: all 0.25s ease;
}
.hero_two:hover {
opacity: 1;
}
.hero_two:hover {
transform: translateY(0);
} */
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pigeon</title>
<link rel="stylesheet" href="style.css" />
<link
rel="stylesheet"
href="https://use.fontawesome.com/releases/v5.14.0/css/all.css"
integrity="sha384-HzLeBuhoNPvSl5KYnjx0BT+WB0QEEqLprO+NBkkk5gbc67FTaL7XIGa2w1L0Xbgc"
crossorigin="anonymous"
/>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.3/css/all.css" integrity="sha384-SZXxX4whJ79/gErwcOYf+zWLeJdY/qpuqC4cAa9rOGUstPomtqpuNWT9wdPEn2fk" crossorigin="anonymous">
</head>
<body>
<!-- Navbar Section -->
<nav class="navbar">
<div class="navbar__container">
Pigeon<small id="trade">TRADE</small>
<div class="navbar__toggle" id="mobile-menu">
<span class="bar"></span>
<span class="bar"></span>
<span class="bar"></span>
</div>
<ul class="navbar__menu">
<li class="navbar__item">
Home
</li>
<li class="navbar__item">
About
</li>
<li class="navbar__item">
Services
</li>
<li class="navbar__btn">
Sign Up
</li>
</ul>
</div>
</nav>
<!-- Hero Section -->
<div class="hero_two hero" id="home">
<div class="hero__container">
<div class="image__overlay">
<div class="hero__content">
<h1 class="hero__heading">Get started <br>making your <span class="orange">online <br>business</span> today!</h1>
</div>
</div>
</div>
<div class="main__btn">
<button class="button button__color">Explore</button>
</div>
</div>
```
The problem is that you are overwriting the background-image property value from .hero when you add background: rgba(0, 0, 0, 0.6); for .hero_two
Use instead background-color: rgba(0, 0, 0, 0.6);
The property background is a shorthand for all background properties including background-image.
The background shorthand CSS property sets all background style properties at once, such as color, image, origin and size, or repeat method.
Read more here -> background property
See below
EDIT after comments:
You are using two classes on the SAME element. If you write some styles for hero_two it will overwrite the styles for hero. because you are selecting the same element.
If I understand correctly, you want to show an 'overlay' and make the text appear when hovering. You can use a pseudo-element for that ( :after in this case) and some tweaks in your css styling. ( Remove the hero_two classname because it's useless )
/* Hero Section */
.hero {
padding: 50px 0;
background-image: url("https://via.placeholder.com/150");
background-size: cover;
overflow: hidden;
position: relative;
background-position: top;
display: flex;
flex-direction: column;
}
.hero__heading {
color: #fff;
font-size: 100px;
margin-left: 30px;
text-shadow: 2px 2px 8px #000000c4;
}
.orange {
color: rgb(255, 89, 0);
}
.main__btn {
margin: 0 auto;
margin-top: 3rem;
}
.main__btn a {
color: #fff;
text-decoration: none;
z-index: 2;
position: relative;
padding: 10px 20px;
font-size: 1.8rem;
}
.button__color {
background: -webkit-linear-gradient(to right, #1e5dff, rgb(255, 89, 0));
background: linear-gradient(to right, #1e5dff, rgb(255, 89, 0));
}
.hero:after {
content: "";
position: absolute;
background-color: rgba(255, 255, 255, 0.6);
top: 0;
opacity: 0;
width: 100%;
height: 100%;
}
.hero * {
transform: translateY(20px);
transition: all 0.25s ease;
opacity: 0;
}
.hero:hover * {
transform: translateY(0px);
color: #ffffff;
opacity: 1;
}
.hero:hover:after {
opacity: 1;
}
<div class="hero_two hero" id="home">
<div class="hero__container">
<div class="image__overlay">
<div class="hero__content">
<h1 class="hero__heading">Get started <br>making your <span class="orange">online <br>business</span> today!</h1>
</div>
</div>
</div>
<div class="main__btn">
<button class="button button__color">Explore</button>
</div>
</div>
Next time please share only relevant code ( eg. navbar has nothing to do with this ) and take the time to make a code snippet like the one above that reproduces your problem. ( For images, please use a placeholder as we cannot use your own images 'cause we don't have them )
happy coding.
The problem I am having is that I have a margin or a container somewhere that is creating an unwanted scroll bar horizontally on the bottom of my webpages. I am using my contact page since it is my page with the least amount of content, even though I am having the issue across all of my other 5 pages linked on this website. I know it will be something simple and would love an extra pair of eyes who could maybe shed some light onto where the issue is. Thanks in advance. Please let me know if there is anything else I can provide for further details. Thanks in advance.
<!doctype html>
<html>
<head>
<meta charset="utf-8" name="viewport" content="width=device-width, initial-scale=1.0">
<title>index.html</title>
<link href="css/style.css" rel="stylesheet" type="text/css"><link rel="preconnect"
href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Lora:wght#500&display=swap" rel="stylesheet">
</head>
<div class="IMGLogo">
<img src="images/RJL photography_Logo.svg" alt="LOGO" width="370.026" height="65.492" ></div>
<div id="wrapper">
<nav role="navigation">
<div id="menuToggle">
<!--
A fake / hidden checkbox is used as click reciever,
so you can use the :checked selector on it.
-->
<input type="checkbox" />
<!--
Some spans to act as a hamburger.
They are acting like a real hamburger,
not that McDonalds stuff.
-->
<span></span>
<span></span>
<span></span>
<!--
Too bad the menu has to be inside of the button
-->
<ul id="menu">
<li>Home</li>
<li>Projects</li>
<li>Lofts</li>
<li>Balcony/Rooftop</li>
<li>Contact</li>
</ul>
</div>
</nav>
</div>
<div>
<main>
<br>
<br><h1>Contact</h1>
<p class="pbox"> The folks at RJL Photography are eager to make your moments last a lifetime. Inquire
below.</p>
<!-- Add icon library -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-
awesome.min.css">
<div class="card">
<img src="images/New/Contact/RyanBio.JPG" alt="Ryan Bio" style="width:100%">
<h1>Ryan Luber</h1>
<p class="title">CEO & Founder, RJL Photography</p>
<p>Frederick, MD</p>
<p>443-222-3333</p>
<p>RJLPhoto#RJLP.COM</p>
<i class="fa fa-dribbble"></i>
<i class="fa fa-twitter"></i>
<i class="fa fa-linkedin"></i>
<i class="fa fa-facebook"></i>
</div>
<br>
<div class="container">
<form action="action_page.php">
<label for="fname">First Name</label>
<input type="text" id="fname" name="firstname" placeholder="Your name..">
<label for="lname">Last Name</label>
<input type="text" id="lname" name="lastname" placeholder="Your last name..">
<label for="pnumber">Phone Number</label>
<input type="text"
id="pnumber"
name="phonenumber"
placeholder="Your phone number..">
<label for="country">Country</label>
<select id="country" name="country">
<option value="usa">USA</option>
<option value="canada">Canada</option>
</select>
<label for="subject">Subject</label>
<textarea id="subject" name="subject" placeholder="Description of your desired Photoshoot."
style="height:200px"></textarea>
<input type="submit" value="Submit">
</form>
</div>
</main>
<!--wrapper--></div>
<footer>© RJLPhotography 2020 </footer>
</html>
wrapper {
margin: auto;
width: 100%;
}
body {
align-content: center;
margin-top: 0;
margin-left: 30;
margin-bottom: 0;
}
article {
background-image: url("../images/BAR.svg");
width: 82%;
padding: 20px;
position: relative;
background-repeat: no-repeat;
background-position: center;
}
h1 {
font-family: 'Lora', serif;
}
h2 {
height: 10em;
display: flex;
align-items: center;
justify-content: center;
margin-left: -200px;
}
/* Container holding the image and the text */
.container {
position: relative;
}
/* Bottom right text */
.text-block {
position: absolute;
bottom: 20px;
right: 20px;
background-color: black;
color: white;
padding-left: 20px;
padding-right: 20px;
}
body {
margin: 20px;
position: relative;
/* make it look decent enough */
background: white;
color: gray;
}
.IMGLogo {
margin: 0 0 0 0;
width: 370.026px;
height: 65.492px;
position: absolute;
left: 40px;
top: -40px;
}
p.pbox {
margin-left: 400px;
margin-right: 400px;
text-align: center;
font-size: 20px;
font-weight: bold;
}
img {
/*display: block;
object-fit:cover;
*/
width: 80%;
height: 90%;
margin-top: 80px;
margin-right: 80px;
margin-left: 0;
margin-bottom: 80px;
max-width: 1000px;
border-radius: 8px;
}
.center {
/*display: block;*/
margin-left: auto;
margin-right: auto;
width: 76%;
}
main {
padding-left: 65px;
position: static;
margin-top: 40px;
width: 100%;
}
#BARcenter {
width: 60%;
height: 100%;
position: relative;
top: -100px;
left: 60px;
z-index: 50;
}
#BARcenter img {
width: 40%;
height: 40%;
}
#menuToggle {
display: block;
position: relative;
top: 130px;
left: 30px;
z-index: 100;
-webkit-user-select: none;
user-select: none;
right: auto;
}
#menuToggle a {
text-decoration: none;
color: white;
transition: color 0.3s ease;
}
#menuToggle a:hover {
color: tomato;
}
#menuToggle input {
display: block;
width: 40px;
height: 32px;
position: absolute;
top: -7px;
left: -5px;
cursor: pointer;
opacity: 0;
/* hide this */
z-index: 2;
/* and place it over the hamburger */
-webkit-touch-callout: none;
}
/*
* Just a quick hamburger
*/
#menuToggle span {
display: block;
width: 33px;
height: 4px;
margin-bottom: 5px;
position: relative;
background: #cdcdcd;
border-radius: 3px;
z-index: 1;
transform-origin: 4px 0px;
transition: transform 0.5s cubic-bezier(0.77, 0.2, 0.05, 1.0), background 0.5s cubic-bezier(0.77, 0.2, 0.05, 1.0), opacity 0.55s ease;
}
#menuToggle span:first-child {
transform-origin: 0% 0%;
}
#menuToggle span:nth-last-child(2) {
transform-origin: 0% 100%;
}
/*
* Transform all the slices of hamburger
* into a crossmark.
*/
#menuToggle input:checked~span {
opacity: 1;
transform: rotate(45deg) translate(-2px, -1px);
background: #232323;
}
/*
* But let's hide the middle one.
*/
#menuToggle input:checked~span:nth-last-child(3) {
opacity: 0;
transform: rotate(0deg) scale(0.2, 0.2);
}
/*
* Ohyeah and the last one should go the other direction
*/
#menuToggle input:checked~span:nth-last-child(2) {
transform: rotate(-45deg) translate(0, -1px);
}
/*
* Make this absolute positioned
* at the top left of the screen
*/
#menu {
position: absolute;
width: 300px;
margin: -100px 0 0 -50px;
padding: 50px;
padding-top: 125px;
opacity: 1;
background-color: rgba(0, 0, 0, 0.5)!important;
list-style-type: none;
-webkit-font-smoothing: antialiased;
/* to stop flickering of text in safari */
transform-origin: 0% 0%;
transform: translate(-100%, 0);
transition: transform 0.5s cubic-bezier(0.77, 0.2, 0.05, 1.0);
}
#menu li {
padding: 10px 0;
font-size: 22px;
}
/*
* And let's slide it in from the left
*/
#menuToggle input:checked~ul {
transform: none;
}
.card {
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
max-width: 300px;
margin: auto;
text-align: center;
}
.title {
color: black;
font-size: 18px;
}
button {
border: none;
outline: 0;
display: inline-block;
padding: 8px;
color: white;
background-color: #000;
text-align: center;
cursor: pointer;
width: 100%;
font-size: 18px;
}
a {
text-decoration: none;
font-size: 22px;
color: black;
}
button:hover,
a:hover {
opacity: 0.4;
}
/* Style inputs with type="text", select elements and textareas */
input[type=text],
select,
textarea {
width: 100%;
/* Full width */
padding: 12px;
/* Some padding */
border: 1px solid #ccc;
/* Gray border */
border-radius: 4px;
/* Rounded borders */
box-sizing: border-box;
/* Make sure that padding and width stays in place */
margin-top: 6px;
/* Add a top margin */
margin-bottom: 16px;
/* Bottom margin */
resize: vertical/* Allow the user to vertically resize the textarea (not horizontally) */
}
/* Style the submit button with a specific background color etc */
input[type=submit] {
background-color: black;
color: white;
padding: 12px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
}
/* When moving the mouse over the submit button, add a darker green color */
input[type=submit]:hover {
background-color: gray;
}
/* Add a background color and some padding around the form */
.container {
border-radius: 5px;
background-color: #f2f2f2;
padding: 20px;
}
footer {
text-align: center;
}
#myBtn {
display: none;
/* Hidden by default */
position: fixed;
/* Fixed/sticky position */
bottom: 0px;
/* Place the button at the bottom of the page */
left: 30px;
/* Place the button 30px from the right */
z-index: 99;
/* Make sure it does not overlap */
border: none;
/* Remove borders */
outline: none;
/* Remove outline */
background-color: black;
/* Set a background color */
color: white;
/* Text color */
cursor: pointer;
/* Add a mouse pointer on hover */
padding: 25px;
/* Some padding */
border-radius: 10px;
/* Rounded corners */
font-size: 18px;
/* Increase font size */
}
#myBtn:hover {
background-color: #555;
/* Add a dark-grey background on hover */
}
On your main tag remove
padding-left: 65px;
and on your MenuToggle remove
left: 30px;
That fixes your issue of having an horizontal scroll bar.
You will then have to have a play about with your hamburger menu and contact text.
Try using position absolute rather than relative on your menuToggle.
I am trying to implement button I took from codepen on my existing "box-list" div.
But in my form the button gets fathers background and I cant perform my original button blue background as it should be.
On the bottom of the page you can see the button outside the "box-list" how it should look.
<link rel="stylesheet" type="text/css" href="style.css">
<div class="box-list">
<!-- FREE TEXT BOX -->
<div class="box" >
<div class="box__inner">
<h1>Free Text</h1>
Get you free text processed and analyzed, and get opinion summery about.
<button class="analyzeBtn mybtn1" >hover</button>
</div>
</div>
<!-- TWITTER BOX -->
<div class="box" >
<div class="box__inner">
<h1>Twitter Search</h1>
Get Twitter post and comments about any subject you choose and analyze the dat
</div>
</div>
<div class="box" >
<div class="box__inner">
<h1>URL</h1>
Get your URL article analyzed
</div>
</div>
</div>
<button class="analyzeBtn mybtn1" >hover</button>
.box-list {
background: #119bc9;
overflow: hidden;
display: flex;
}
.box {
min-height: 300px;
color: #fff;
transition: all 0.5s;
max-height: 300px;
background-image: url('http://lorempixel.com/400/300/sports');
background-size: cover;
width: 33.33%;
}
.box__inner {
padding: 20px;
min-height: 300px;
background-color: rgba(17, 155, 201, 0.7);
}
.box:hover {
width: 150%!important;
font-size: 18px;
}
.box:nth-child(odd) {
background-image: url('/images/text.jpg');
}
.box:nth-child(odd) .box__inner{
background: rgba(71, 83, 157, 0.8);
}
.analyzeBtn {
border: 1px solid #3498db;
background: none;
padding: 10px 20px;
font-size: 20px;
font-family: "montserrat";
margin: 10px;
transition: 0.8s;
position: relative;
cursor: pointer;
overflow: hidden;
border-radius: 5px;
}
.mybtn1 {
color: #fff;
}
.mybtn1:hover {
color: #3498db;
transform: translateY(-7px);
transition: 0.4s;
}
.analyzeBtn::before {
content: "";
position: absolute;
left: 0;
width: 100%;
height: 0%;
background: #3498db;
z-index: -1;
transition: 0.6s;
}
.mybtn1::before {
top:0;
border-radius: 0 0 50% 50%;
height: 180%;
}
.mybtn1:hover::before {
height: 0%;
}
JSfiddle example
You need to add z-index: 1; to the button so that it is displayed on top of the backgrounds:
.analyzeBtn {
border: 1px solid #3498db;
background: none;
padding: 10px 20px;
font-size: 20px;
font-family: "montserrat";
margin: 10px;
transition: 0.8s;
position: relative;
cursor: pointer;
overflow: hidden;
border-radius: 5px;
z-index: 1;
}
I am having a problem with the hero image, it always hides my dropdown menu even though I put a higher z-index on the menu. I have found a "solution" for this, I gave the hero image z-index:-1, but now my button on the hero image doesn't work. I want to have this work without any workarounds.
jsfiddle here (here the dropdown works, because #hero-img has z-index:-1, but the top button doesn't work)
https://jsfiddle.net/xLo7wcph/1/
1) please help me find a reason why the z-index > 0 doesn't work + solution for this, without using z-index:0;
2) bonus question, why the button doesn't work when I set the hero img on negative z-index even though I have btn z-index : 1;
<nav id="navbar" class="flex">
<div class="flex-1 "><img src="images/drevo2.svg"></div>
<div class="flex-2 ">falco's woodwork.</div>
<div class="flex-3 flex-element push">
domů
</div>
<div class="flex-4 flex-element">
nabídka
<div class="dropdown">
<p>motýlci</p>
<p>dekorace</p>
<p>ostatní</p>
</div>
</div>
<div class="flex-5 flex-element">
kontakt
</div>
<div class="flex-6 flex-element">
nákup
</div>
</nav>
<div id="hero-img">
<div class="text-box">
<h1>
<span class="text-box--main">objevte krásu</span>
<br>
<span class="text-box--sub">ručně tvořených výrobků</span>
<br>
</h1>
</div>
<button class="btn"><img src="images/SIPKA DOLU.svg"></button>
</div>
#navbar{
border-bottom:solid 1px black;
.dropdown{
position:absolute;
z-index: 3;
display:none;
border-top:none;
padding:1rem 2rem;
background-color: rgba(0, 0, 0, 0.801);
left:-1.8rem;
top:3.7rem;
p{
color:white;
&:hover{
border-bottom: 1px solid white;
}
}
}
.flex-element:hover .dropdown{
display:block;
z-index: 2;
}
}
#hero-img{
position: relative;
background:linear-gradient(to top, black 0%, rgba(0, 0, 0, 0.5) 0%), url("../images/hero image.jpg") no-repeat top;
height: calc(100vh - 3.8rem);/* - vyska nav baru*/
background-size: cover;
z-index: -1;
}
Removing z-index: -1; from the #hero-img and adding these lines solves your problem.
#navbar{
position: relative;
z-index: 1;
}
Initially what was happening is, position: relative on #hero-img was hiding your dropdown. because position-wise #hero-img was upper than #navbar. that's why you should also add z-index in the #navbar.
And you gave negative z-index value to appear the dropdown. when you give negative z-index to an element it will be rendered under other elements.
In this case, the #hero-img was under the body. the button won't show up when you give high z-index value because it's parent #hero-img is under the top layer.
working demo:
btn,
.btn:link,
.btn:visited {
background-color: rgba(255, 255, 255, 0);
border-style: none;
animation: btnFadeIn .5s ease-in forwards;
outline: none;
position: absolute;
bottom: 2%;
left: 50%;
transform: translateX(-50%);
z-index: 3; }
.btn:hover {
cursor: pointer; }
#navbar {
border-bottom: solid 1px black; }
#navbar .dropdown {
position: absolute;
z-index: 3;
display: none;
border-top: none;
padding: 1rem 2rem;
background-color: rgba(0, 0, 0, 0.801);
left: -1.8rem;
top: 3.7rem; }
#navbar .dropdown p {
color: white; }
#navbar .dropdown p:hover {
border-bottom: 1px solid white; }
#navbar .flex-element:hover .dropdown {
display: block;
z-index: 2; }
#navbar .flex-1 {
width: 3rem;
height: 3rem;
margin-left: .5rem;
align-self: center;
padding: .3rem;
font-size: 2rem; }
#navbar .flex-2 {
padding: .3rem;
font-size: 2rem;
margin-right: 5rem; }
#navbar .flex-2 a {
text-decoration: none;
color: black; }
#navbar .flex-element {
padding: .3rem;
font-size: 2rem;
margin-right: 5rem;
transition: all .2s ease-out;
position: relative; }
#navbar .flex-element a {
text-decoration: none;
color: black; }
#navbar .flex-element:first-child {
margin-right: 0; }
#navbar .flex-element:hover {
transform: translateY(1.5px); }
#navbar .flex-element:active {
transform: translateY(-1.5px); }
#font-face {
font-family: 'Proxima Nova';
src: url("../proxima_ssv/Proxima Nova Thin.otf") format("opentype"); }
*,
*::after,
*::before {
margin: 0;
padding: 0;
box-sizing: inherit; }
html {
font-size: 62.5%;
scroll-behavior: smooth; }
body {
font-family: 'Proxima Nova', sans-serif;
line-height: 1.6;
color: black;
box-sizing: border-box; }
.push {
margin-left: auto; }
.line {
background-color: #C6C6C6;
border: solid .1rem #C6C6C6;
max-width: 960px; }
#navbar{
position: relative;
z-index: 1;
}
#hero-img {
position: relative;
/*background: linear-gradient(to top, black 0%, rgba(0, 0, 0, 0.5) 0%), url("../images/hero image.jpg") no-repeat top;*/
background-color:darkgreen;
height: calc(100vh - 3.8rem);
/* - vyska nav baru*/
background-size: cover;
}
.text-box {
position: absolute;
top: 30%;
left: 50%;
transform: translate(-50%, 40%);
backface-visibility: hidden;
text-transform: uppercase;
text-align: left; }
.text-box h1 {
line-height: 1; }
.text-box--main {
display: inline-block;
font-size: 4rem;
color: white;
animation: moveInLeft 1.5s ease-out; }
.text-box--sub {
display: inline-block;
color: white;
font-size: 6.5rem;
animation: moveInRight 1.5s ease-out; }
.flex {
display: flex;
flex-wrap: wrap; }
<nav id="navbar" class="flex">
<div class="flex-1 "></div>
<div class="flex-2 ">falco's woodwork.</div>
<div class="flex-3 flex-element push">
domů
</div>
<div class="flex-4 flex-element">
nabídka
<div class="dropdown">
<p>motýlci</p>
<p>dekorace</p>
<p>ostatní</p>
</div>
</div>
<div class="flex-5 flex-element">
kontakt
</div>
<div class="flex-6 flex-element">
nákup
</div>
</nav>
<div id="hero-img">
<div class="text-box">
<h1>
<span class="text-box--main">objevte krásu</span>
<br>
<span class="text-box--sub">ručně tvořených výrobků</span>
<br>
</h1>
</div>
<button class="btn">theButtonThatDoesntWork</button>
</div>
I want to change (a) tag to (li). When i do it css animation stop working. Why? It is not first time when i change (a) tag to (li) but i never have problem like this. Of course you need to do manipulations in css but this time i can not solve this problem. How can i change it?
<div class="panel" id="slice">
<div class="panel__content">
Close me.
</div>
</div>
<div class="menu">
<a class="menu__link" href="#slice" data-hover="Slice">Slice</a>
</div>
.menu {
position: fixed;
width: 100vw;
pointer-events: none;
margin-top: 10vh;
text-align: center;
z-index: 2; }
.menu__link {
display: inline-block;
text-decoration: none;
border: 2px solid #263238;
color: #263238;
pointer-events: auto;
line-height: 40px;
position: relative;
padding: 0 50px;
box-sizing: border-box;
margin: 0;
user-select: none;
overflow: hidden;
border-radius: 50px;
.panel {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
overflow: auto;
z-index: 999;
color: #000;
box-sizing: border-box;
background-color: #ECEFF1; }
.panel__content {
opacity: 0;
will-change: margin-top;
transition: all 700ms;
transition-delay: 600ms;
padding: 100px 200px;
margin-top: -5%; }
.panel:target .panel__content {
opacity: 1;
margin-top: 0; }
.panel#slice {
background-color: #E53935;
transition: all 800ms cubic-bezier(0.190, 1.000, 0.560, 1.000);
transform: translate3d( 0, -100%, 0 ); }
.panel#slice:target {
transform: translate3d( 0, 0, 0 ); }
You'd have to restyle the unordered list for spacing, but maybe instead of outright replacing your menu's <a> elements with <li>, you could include the <a> elements in the resulting list items.
This would preserve all the :target functionality and give you the list (for semantics?).
EDIT: Of course, this won't do at all if your menu just can not consist of anything but <li>.
/* basic style definition */
/* •••••••••••••••••••••••••••••••• */
body {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-family: 'Roboto Slab', serif;
}
h1 {
margin: 0;
user-select: none;
text-align: center;
font-weight: 300;
}
p,
{
font-weight: 300;
color: #546E7A;
user-select: none;
text-align: center;
margin: 0;
}
a {
text-align: center;
text-decoration: none;
color: #FFF;
}
/* Navigation menu */
/* •••••••••••••••••••••••••••••••• */
.menu {
position: fixed;
width: 100vw;
pointer-events: none;
margin-top: 10vh;
text-align: center;
z-index: 2;
}
/* Menu link item */
.menu__link {
display: inline-block;
text-decoration: none;
border: 2px solid #263238;
color: #263238;
pointer-events: auto;
line-height: 40px;
position: relative;
padding: 0 50px;
box-sizing: border-box;
margin: 0;
user-select: none;
overflow: hidden;
border-radius: 50px;
&::before {
content: attr(data-hover);
background-color: #263238;
color: #FFF;
position: absolute;
top: 100%;
bottom: 0;
left: 0;
transition: all 300ms cubic-bezier(0.190, 1.000, 0.560, 1.000);
right: 0;
}
&:hover::before {
top: 0;
}
}
/* Panels Style*/
/* •••••••••••••••••••••••••••••••• */
/* Common panel style */
.panel {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
overflow: auto;
z-index: 999;
color: #000;
box-sizing: border-box;
background-color: #ECEFF1;
}
/* panel content (only for animation delay after open) */
.panel__content {
opacity: 0;
will-change: margin-top;
transition: all 700ms;
transition-delay: 600ms;
padding: 100px 200px;
margin-top: -5%;
}
/* Panel content animation after open */
.panel:target .panel__content {
opacity: 1;
margin-top: 0;
}
/* Specific "Home "panel */
/* •••••••••••••••••••••••••••••••• */
.panel#home {
z-index: 1;
background: radial-gradient(ellipse at center, rgba(255, 255, 255, 1) 0%, #CFD8DC 100%);
}
/* Specific panel "Slice" */
/* •••••••••••••••••••••••••••••••• */
.panel#slice {
background-color: #E53935;
transition: all 800ms cubic-bezier(0.190, 1.000, 0.560, 1.000);
transform: translate3d( 0, -100%, 0);
}
.panel#slice:target {
transform: translate3d( 0, 0, 0);
}
/* Specific panel "Fade" effect */
/* •••••••••••••••••••••••••••••••• */
.panel#fade {
background-color: #00C853;
opacity: 0;
transition: all 800ms;
pointer-events: none;
}
.panel#fade:target {
opacity: 1;
pointer-events: auto;
}
<!-- Home Panel -->
<div class="panel" id="home">
<h1>Pure CSS panels</h1>
<p>by Mattia Astorino</p>
</div>
<div class="panel" id="slice">
<div class="panel__content">
<a href="#home">
Close me.
</a>
</div>
</div>
<div class="panel" id="fade">
<div class="panel__content">
Close me.
</div>
</div>
<!-- Navigation -->
<div class="menu">
<ul>
<li>
<a class="menu__link" href="#slice" data-hover="Slice">Slice</a>
</li>
<li>
<a class="menu__link" href="#fade" data-hover="Fade">Fade</a>
</li>
</ul>
</div>