I want to have a header on my website with some text which is centred in the page. There should be a button on the same height/line which is aligned to the right.
This is what I've got currently:
And this is defined like this:
<header>
<h1>Please Center Me</h1>
<span class="material-icons">search</span>
</header>
header {
width: 100%;
height: auto;
background-color: #1DA87F;
color: #EBEF8E;
font-size: 1.5em;
display: flex;
}
header h1 {
margin: auto;
align-self: center;
}
.material-icons {
font-size: 1.5em;
margin: auto;
align-self: flex-end;
}
As you can see, the "Please Center Me" text is not really centered, it's being off-set by the search
text (icon).