My dilemma lies in the header div
where I need to position a logo and navigation menu. The logo sits on the left side with dimensions of 100x50
, while the navigation menu is set to float: right
.
How can I ensure that the navigation menu aligns just above the base of the header div? Is there a way to dynamically adjust this positioning based on changes to the logo size, without manually tweaking the margin-top
for the nav
element?
HTML
<div class="container">
<header class="site-header">
<div class="site-logo">
</div><!-- /site-logo -->
<nav class="site-nav">
</nav>
</header>
</div>
CSS
.site-header nav ul {
float: right;
border: 1px solid green;
}
div.site-logo {
float: left;
width: 100px;
height: 50px;
border: 1px solid #000;
}
P.S.: I am hoping to achieve this without relying on javascript.