I'm facing an issue while creating a website. The 'margin: auto' and 'text-align: center' properties in my CSS code seem to not be functioning as expected. Can someone please review my code in inspect element and identify the problem?
body {
font-family: sans-serif, 'Helvetica';
background-color: #f9f9f9;
}
.dropdown {
position: relative;
}
.dropdown-content {
display: none;
position: absolute;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
}
.dropdown-content a {
display: block;
}
.dropdown:hover .dropdown-content {
display: block;
}
#my_cycle_head {
text-align: center;
}
#main_navbar {
text-align: center;
margin: 0 auto;
margin-right: auto;
margin-left: auto;
width: 800px;
}
#main_navbar nav a {
text-decoration: none;
text-align: center;
}
#main_navbar nav {
display: inline-block;
text-align: center;
padding-right: 20px;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Cycle - Home</title>
<link rel="stylesheet" href="css/style.css" type="text/css" />
</head>
<body>
<header>
<h1 id="my_cycle_head">My Cycle</h1>
<navbar id="main_navbar">
<nav><a href="#">Home</a>
</nav>
<nav class="dropdown">
<a class="dropbtn">Dropdown</a>
<div class="dropdown-content">
<a href="#">Link 1</a>
<a href="#">Link 2</a>
<a href="#">Link 3</a>
</div>
</nav>
<nav><a href="faq.html">FAQ's</a>
</nav>
<nav><a href="about.html">About</a>
</nav>
</navbar>
</header>
</body>
</html>