<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="Abstract.css">
<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=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet">
<style>
* {
font-family: "Poppins", sans-serif;
margin: 0;
padding: 0;
}
html, body {
width: 100%;
height: 100%;
}
body {
height: 100vh;
}
:root {
--signbutton: #4C5FD5;
--searchbackground: #dadbf1;
--navfooter: #000000;
--background: #fff;
}
nav {
display: flex;
background: #000000;
color: var(--background);
height: 10vh;
align-items: center;
}
nav .title {
display: flex;
margin-right: auto;
align-items: center;
}
nav .buttons {
display: flex;
align-items: center;
height: 10px;
}
.title h1 {
font-size: 28px;
}
.divider {
width: 2px;
height: 30px;
background-color: #fff;
margin: 7px ;
}
.responsivebtn {
position: relative;
}
.close, .menu {
cursor: pointer;
right: 100px;
position: absolute;
display: none;
}
.menu-icon {
display: flex;
align-items: center;
cursor: pointer;
}
.close, .menu {
position: absolute;
top: 0;
right: 0;
display: none;
}
#active:not(:checked) ~ .menu-icon .menu {
display: block;
}
#active:checked ~ .menu-icon .close {
display: block;
}
#active {
display: none;
}
.dropdown {
background-color: #1f1e1e;
color: #fff;
width: 100%;
height: 24%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-size: 30px;
}
.margin {
margin-top: 8px;
width: 50%;
height: 2px;
background-color: #dadbf1;
}
.dropdown p {
margin-top: 5px;
}
</style>
</head>
<body>
<nav>
<div class="title">
<img src="icons8-logo-50.png" alt="Logo">
<h1>Abstract</h1>
<div class="divider"></div>
<span>Help Center</span>
</div>
<div class="buttons">
<div class="responsivebtn">
<input type="checkbox" id="active">
<label for="active" class="menu-icon">
<div class="close">
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#5f6368"><path d="m256-200-56-56 224-224-224-224 56-56 224 224 224-224 56 56-224 224 224 224-56 56-224-224-224 224Z"/></svg>
</div>
<div class="menu">
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#5f6368"><path d="M120-240v-80h720v80H120Zm0-200v-80h720v80H120Zm0-200v-80h720v80H120Z"/></svg>
</div>
</label>
</div>
<div class="btn">
<input type="button" value="Submit a request">
<input type="button" value="Sign in">
</div>
</div>
</nav>
<div class="dropdown">
<p>Submit request</p>
<div class="margin"></div>
<p>Sign in</p>
</div>
</body>
</html>
I have tried using the #active:checked ~.dropdown
to connect the dropdown action of appearing and disappearing on press, to the menu/close icon checkbox but it does not seem to work. Do you think making this with only html css feasible or do i have to use Java script to achieve results. As for a month or so i have been practicing css and html seeing how far i can go without it, do you think its about time i start javascript ?