In a header top banner:
#header { background-color: #eaeaea; }
#header a { display: inline-block; margin-right: 1.5em; }
.logo { margin-right: 6em; }
<div id="header">
<img src="https://via.placeholder.com/150x120" class="logo">
<a href="">Lorem</a>
<a href="">Ipsum</a>
<a href="">Contact</a>
</div>
what are the main methods used nowadays to center the 3 right links vertically inside the banner?
I know how to do it with position: relative; top:-...px
or similar methods or even <table>
, but what would be considered nowadays as the most appropriate methods, especially for responsive design?
Would you use flex
features for this? If so, how?
I also want stick the group of 3 links to the right border of the screen, such that, if we resize the browser width, it always stays floating along the right border. I was about to use float: right
but there's probably a better solution than mixing flex
and float
?
PS: These last details are not in the linked questions Flexbox: center horizontally and vertically and How to Vertical align elements in a div?, thus it's not a duplicate.