I have created a unique navigation bar design for my website using the CSS code provided below:
<style>
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #ff9933;
font-size:90%;
}
li {
float: left;
border-right: 1px solid #ffb366;
}
li a {
display: block;
color: white;
text-align: center;
padding-left: 10px;
padding-right: 10px;
padding-top: 3px;
padding-bottom: 3px;
text-decoration: none;
}
li a:hover {
background-color: #e67300;
}
</style>
This customized horizontal navigation bar is inspired by an example on w3schools.com, which you can view here
The issue I'm facing is that this style affects all <li>
and <ul>
elements on my website, not just the navbar. How can I ensure that only the navbar elements are styled differently using CSS alone? As a beginner in CSS, I believe I might be overlooking a basic concept here.