How can I add spacing in the navigation bar? here's the code I have written btw I am still a noob learning coding so yeah!
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
margin: 0;
font-family: Arial, Helvetica, sans-serif;
}
.topnav {
overflow: hidden;
background-color: #FFFFFFF;
}
.topnav a {
float: left;
color: #000000;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-size: 17px;
}
.topnav a:hover {
background-color: #ddd;
color: black;
}
.topnav a.active {
background-color: #FFFFFFF;
color: black;
}
</style>
</head>
<body>
<div class="topnav">
<a class="active" href="#home">Home</a>
<a href="men.html">Men</a>
<a href="women.html">Women</a>
<a href="our-materials.html">Our Materials</a>
<a href="stores.html">Stores</a>
</div>
<div style="padding-left:10px">
<h2>Top Navigation Example</h2>
<p>Some content..</p>
</div>
Please provide exact details I should do and better it be in html
You can add space un numerous ways. I advice you to delete the
float:left;
because is not the current best way to do this.In spite of you can add
display: inline-block
to the elements or putdisplay: flex
to the topnav class.If you user inline-block you will be able to add margin to the a, if you use flex type you can read more about on https://css-tricks.com/snippets/css/a-guide-to-flexbox/
I hope you understand and learn more about flex and the display option.