Below is the code snippet I'm currently working on:
.nav-item {
display: inline;
color: white;
padding: 30px 10px;
font-style: bold;
font-family: sans-serif;
font-size: 20px;
width: 1000px;
margin: 0 auto;
}
.nav-container {
background-color: black;
}
<nav class="nav-container">
<span class="nav-item">ABOUT ME</span>
<span class="nav-item">CONTACT ME</span>
<span class="nav-item">PORTFOLIO</span>
</nav>
I've encountered an issue while trying to center my navigation bar in the middle of the page using margin: auto
. Despite my efforts, it doesn't seem to work as expected. Surprisingly, when I set display: block
, it centers the bar but breaks the line layout. Could someone please shed some light on why this might be happening? Any assistance would be greatly appreciated...