The websites width becomes wider than viewport, so youll be able to scroll "to the side". How can i remove this? I have tried searching
for solutions, but they dont seem to work. I'd like to keep the hamburger navbar where it was, just remove the extra space is creates. I think its because theres a shape thats created, so it wont work with just
position:absolute;
width: 100%;
height: 1000px;
object-fit: cover;
left:0;
as these would ruin the shape. Here is the css and html code:
CSS
html { font-size: 18px; }
body {
color: #e0e4cc;
font-size: 1.2em;
line-height: 1.6;
background: #fa6900;
}
/* x box color */
label .menu {
position: absolute;
right: -100px;
top: -100px;
z-index: 100;
width: 200px;
height: 200px;
background: rgb(0, 0, 0);
border-radius: 50% 50% 50% 50%;
-webkit-transition: .5s ease-in-out;
transition: .5s ease-in-out;
box-shadow: 0 0 0 0 rgb(0, 0, 0), 0 0 0 0 rgb(0, 0, 0);
cursor: pointer;
text-align: center;
}
/* HOVER EFFECT */
#navs a:hover {
color: #e71f2d;
text-decoration: none;
}
#navs .active {
color: #e71f2d;
}
/* HOVER EFFECT ^*/
label .hamburger {
position: absolute;
top: 135px;
left: 50px;
width: 30px;
height: 2px;
background: #DAA520;
display: block;
-webkit-transform-origin: center;
transform-origin: center;
-webkit-transition: .5s ease-in-out;
transition: .5s ease-in-out;
}
label .hamburger:after, label .hamburger:before {
-webkit-transition: .5s ease-in-out;
transition: .5s ease-in-out;
content: "";
position: absolute;
display: block;
width: 100%;
height: 100%;
background: #DAA520;
}
label .hamburger:before { top: -10px; }
label .hamburger:after { bottom: -10px; }
label input { display: none; }
/* FOOTER SIZE & COLOR*/
label input:checked + .menu {
box-shadow: 0 0 0 200vw rgb(0, 0, 0), 0 0 0 200vh rgb(0, 0, 0);
border-radius: 0;
opacity: 80%;
}
label input:checked + .menu .hamburger {
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
}
label input:checked + .menu .hamburger:after {
-webkit-transform: rotate(90deg);
transform: rotate(90deg);
bottom: 0;
}
label input:checked + .menu .hamburger:before {
-webkit-transform: rotate(90deg);
transform: rotate(90deg);
top: 0;
}
label input:checked + .menu + ul { opacity: 1; }
label ul {
z-index: 200;
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
opacity: 0;
-webkit-transition: .25s 0s ease-in-out;
transition: .25s 0s ease-in-out;
text-align: center;
}
label a {
margin-bottom: 1em;
display: block;
color: #DAA520;
text-decoration: none;
}
h1 {
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
width: 80%;
text-align: center;
}
HTML
<label>
<input type="checkbox">
<span class="menu"> <span class="hamburger"></span> </span>
<ul id="navs">
<a href="#">Home</a>
<a href="#">About</a>
<a href="#">Contact</a>
</ul>
</label>