Is there a way to specifically target the <ul>
and <li>
elements within a designated <div>
, rather than applying styles globally? Here is an example of the HTML structure:
<div id="navbar_div">
<ul>
<li><a href="">Home</a></li>
<li><a href="">Products</a></li>
<li><a href="">Blog</a></li>
<li><a href="">About</a></li>
<li><a href="">Contact</a></li>
</ul>
</div>
My goal is to achieve something like the following CSS:
div#navbar_div {
float:right;
}
div#navbar_div ul {
list-style-type: none;
margin: 0;
padding: 0;
}
div#navbar_div li {
display: inline;
}