I am trying to vertically center a text and a button within a container. The text should be positioned in the middle of the div, while the button should be aligned to the right.
What is the best way to achieve this layout where the text element is centered and the button is on the right side?
My current code looks like this:
* {
margin: 0;
}
body {
color: #ffffff;
background-color: #4a4a4a;
}
#header {
height: 60px;
background-color: #313132;
}
#headerTitle {
font-weight: bold;
text-align: center;
font-size: 30px;
top: 50%;
left: 50%;
}
#menuBtn {
right: 20%;
}
<div id="header">
<p id="headerTitle">Title</p>
<button id="menuBtn">Menu</button>
</div>