Tristan T Tristan T - 22 days ago 5x
CSS Question

Label toggle checkmark over whole page

I am trying to use a label to toggle a checkmark. When you press the label the checkmark is checked but when you press another part of the page the checkmark is also checked which isn't my intention.

I don't really get why this is the case. Can you explain it and explain how to fix it?

header {
height: 100vh;
background-size: cover;
background-position: center;
margin-bottom: 50px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
text-transform: uppercase;
color: black;
h1 {
font-size: 50px;
letter-spacing: 8px;
ul {
list-style-type: none;
margin-left: 0px;
padding-left: 0px;
p {
width: 600px;
margin: 0 auto 20px;
body {
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
margin-left: 0px
.container {
margin: auto;
width: 80%;
.page-content {
position: relative;
z-index: 0;
transition-duration: 0.4s;
.sidebar {
position: fixed;
top: 0px;
left: -180px;
right: 0;
bottom: 0px;
width: 120px;
padding: 30px;
background-color: black;
z-index: 0;
width: 120px;
transition-duration: 0.4s;
.sidebar a {
text-decoration: none;
opacity: 0.8;
font-family: monospace;
font-size: 25px;
.sidebar li {
margin-bottom: 15px;
.sidebar a:hover {
opacity: 1;
.toggle {
position: fixed;
top: 20px;
right: 0;
bottom: 0;
left: 20px;
z-index: 1;
color: black;
transition-duration: 0.4s;
#sidebartoggler:checked + .page-wrap .sidebar {
left: 0px;
#sidebartoggler:checked + .page-wrap .toggle {
left: 200px;
#sidebartoggler:checked + .page-wrap .page-content {
padding-left: 180px;

<!doctype html>
<html lang="en">

<meta charset="UTF-8">
<meta name="description" content="A page about me">
<meta name="keywords" content="web developer, projects">
<meta name="author" content="Tristan Trouwen">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>hello - Tristan Trouwen</title>

<!-- own style sheet -->
<link rel="stylesheet" href="/static/css/style.css">
<!-- favicon -->
<link rel='icon' href="/static/assets/favicon.ico">
<!-- google icons -->
<link href="" rel="stylesheet">
<!-- the icon font -->
<link href="" rel="stylesheet">



<input type="checkbox" id="sidebartoggler" name="" value="">

<div class="page-wrap">

<label for="sidebartoggler"><i class="material-icons md-36 toggle">menu</i>

<div class="page-content">




<div class="sidebar">

<li><a href="/index">home</a>
<li><a href="/shoutbox">shoutbox</a>
<li><a href="/resume">resume</a>
<li><a href="/projects">projects</a>





Remove .toggle { right: 0; bottom: 0; }