ul
tags typically come with a preset padding
on the left side due to the list-style
property. By inspecting the element in the console, you can identify what is causing these margins. To resolve this issue, simply include the following code:
#nav {
margin: 0;
padding: 0;
}
Consider utilizing a reset.css file to streamline the process of resetting styles for lists across your website. Implementing global selectors like this in your CSS stylesheet:
ul {
margin: 0;
padding: 0;
}
Avoid using global selectors to reset styles for all elements as it may impact performance by slowing down code execution. I hope this explanation proves helpful.