I have a menu in an unordered list and I am struggling to make each <li>
the height of its parent. Despite knowing that this is a basic task, I can't seem to figure out where I am going wrong.
<div class="menu">
<ul>
<li class="current_page_item">
<a href="#">Home</a>
</li>
<li class="page_item page-item-2">
<a href="index.php/sample-page/">Sample Page</a>
</li>
</ul>
</div>
In addition, here is the CSS code I currently have:
.main-navigation ul {
float: left;
list-style: outside none none;
margin: 0;
padding-left: 16px;
padding-right: 16px;
}
There are no CSS rules defined for the enclosing div element.
The HTML snippet mentioned above resides within a div tag with no explicit height set. It adapts its height based on the image it contains. You can view the actual website at:
My ultimate goal is to adjust the height of each <li>
element so that I can apply a top border when the link is active.