HTML Code
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="landingpage.css">
<title>Landing Page</title>
</head>
<body>
<div class='navbar'>
<div class='left-section'>
<p class='name'>Balls</p>
</div>
<div class='middle-section'>
<a href="#"><p>WHY BALLS</p></a>
<a href="#"><p>REVEIWS</p></a>
<a href="#"><p>ABOUT</p></a>
</div>
<div class='right-section'>
<p>LOG IN</p>
<button class='free-trial'>FREE TRIAL</button>
</div>
</div>
</body>
</html>
CSS Code
I'm trying to make a fixed nav bar .The position: fixed is in the .navbar class. When I put position: fixed, the words overlap in the navbar but if you didn't put it, it works perfectly and it doesn't overlap. How do I fix this? Btw, my design only works with full screen because the words overlap.
body {
margin: 0px;
margin-bottom: 1000px
}
p {
font-family: Arial;
white-space: nowrap;
}
a {
font-size: 11px;
margin-right: 20px;
color: black;
font-family: Arial, Helvetica, sans-serif;
text-decoration: none;
white-space: nowrap;
}
.middle-section {
display: flex;
align-items: center;
justify-content: space-evenly;
flex:1;
width: 100px;
margin-left: 10px
}
.navbar {
display:flex;
align-items: center;
position: fixed
}
.right-section {
display: flex;
justify-content: space-evenly;
width: 200px
}
.left-section {
}
.name {
font-weight: 600;
margin-left: 20px;
font-size:20px;
}
.free-trial {
background-color: white;
border-style: solid;
border-width: 1px;
border-color: black;
width: 200px;
height: 40px;
vertical-align:middle;
border-radius: 5px;
margin-left: 30px;
margin-top: 3px;
}
This is the code with the error. If you want to see the desired output, remove the position: fixed from css code
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="landingpage.css">
<title>Landing Page</title>
</head>
<body>
<div class='navbar'>
<div class='left-section'>
<p class='name'>Balls</p>
</div>
<div class='middle-section'>
<a href="#"><p>WHY BALLS</p></a>
<a href="#"><p>REVEIWS</p></a>
<a href="#"><p>ABOUT</p></a>
</div>
<div class='right-section'>
<p>LOG IN</p>
<button class='free-trial'>FREE TRIAL</button>
</div>
</div>
</body>
</html>