I'm going crazy over this issue. My navigation bar has three div elements, each with text aligned both vertically and horizontally at the center.
However, when I insert an image (an SVG icon of a zoom lens) before the "search" text, it shifts the text to the bottom.
Here's the code snippet:
HTML
<nav>
<div id="leftside">
<img src="img/zoom-lens.png" alt="search">
search
</div>
<div id="middle">
Arkadomundo
</div>
<div id="rightside">
Sign Up
</div>
</nav>
CSS
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');
* {
margin: 0;
padding: 0;
}
nav {
height: 70px;
width: 100%;
background-color: #241F1C;
font-family: 'Press Start 2P', cursive;
color: #FFFFFF;
display: flex;
align-items: center;
}
#leftside {
flex-grow: 1;
text-align: left;
margin-left: 10px;
}
#leftside img {
height: 50px;
}
#middle{
flex-grow: 2;
text-align: center;
}
#rightside {
flex-grow: 1;
text-align: right;
margin-right: 10px;
}
It seems like a simple problem for you, but I'm struggling to figure out why this is happening.