I want to create a header with two columns, one for the "brand name" and one for buttons, such as login, sign up etc.
However I can't wrap my head around how to vertical center them inside the header, because the buttons are much taller than the brand name.
I also already stumbled across this question, however the solution suggested there did not resolve my issue.
What I have got so far:
header {
border: 1px dotted magenta;
}
header:after {
content: "";
display: table;
clear: both;
}
#left {
background-color: #cfc;
float: left;
vertical-align: middle;
}
#right {
background-color: #ccf;
float: right;
vertical-align: middle;
}
button {
padding: 8px 10px;
}
<header>
<div id="left">
My brand name
</div>
<div id="right">
<button>Button 1</button>
<button>Button 2</button>
<button>Button 3</button>
</div>
</header>
As you can see in the snippet above, the text My brand name
is vertically aligned to the top. However, the desired result would be the text being vertically centered inside the header. How can I accomplish this?