<head>
<link rel="preconnect" href="
You do not have permission to view the full content of this post.
Log in or register now.">
<link href="
You do not have permission to view the full content of this post.
Log in or register now." rel="stylesheet">
<link rel="stylesheet" href="
You do not have permission to view the full content of this post.
Log in or register now.">
<title>Planets</title>
<link rel="stylesheet" href="./style.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<nav>
<div class="logo">PLANETS</div>
<ul class="nav-links" id="link">
<li><a href="#">home</a></li>
<li><a href="#">about</a></li>
<li><a href="#">contact</a></li>
</ul>
<span class="slide">
<a href="#" onClick="openSlideMenu()">
<i class="fa fa-bars fa-2x"></i>
</a>
</span>
</nav>
</body>
CSS
* {
margin: 0px;
padding:0px;
box-sizing: border-box;
}
body {
background-color: black;
overflow-x: hidden;
}
nav {
display: flex;
justify-content: space-around;
padding: 10px;
color: white;
border-bottom:1px solid #dddddd;
font-family: 'Poppins', sans- serif;
}
.logo {
font-weight: 400;
letter-spacing: 1px;
color: #8540ff;
font-size: 1.5rem;
flex: 1 1 auto;
}
.nav-links {
display: flex;
justify-content: space-around;
flex: 1 1 auto;
transition: all 1s ease;
}
.nav-links a {
text-decoration: none;
color: #dcdcdc;
font-size: 1rem;
text-transform: uppercase;
position: relative;
cursor: pointer;
caret-color: #8540ff;
}
.nav-links li {
list-style: none;
}
span{
flex:1 0 auto;
postion:relative;
text-align:right;
align-self:center;
}
.fa {
display: none;
color: #e9e9e9;
position: relative;
}
media only screen and (max-width: 760px) {
.nav-links{
display:none;
}
.toggle-link{
display:flex;
flex-direction:column;
position:absolute;
width:auto;
top: 63px;
padding: 20px;
background:white;
right:0;
}
.logo {
font-size: 1.8rem;
}
nav {
padding: 10px;
}
}
JS
function openSlideMenu(){
let link = document.getElementById("link")
console.log(link.classList.toggle("toggle-link"))
}