I'm trying to do a navigation bar in CSS with two buttons on the left side and one image on the right. The problem is that my image has to fit the size of the navigation bar, and at the same time, it has to be vertically centered. If anyone could help me solve this, I would be truly glad.
Solution: I ended up solving it by using "flex" and "margin" (the navigation bar display property was set to flex and the icon margin-left was set to auto, making it go to the right of the flex row). Here is a code example: https://jsfiddle.net/572bag0z/#&togetherjs=QJn2LqjxTQ
.top-nav {
position: fixed;
display: flex;
overflow: hidden;
background-color: white;
align-items: center;
height: 4em;
width: 100%;
box-shadow: 0 .5px 4px;
}
.top-nav a {
float: left;
color: #f2f2f2;
text-align: center;
text-decoration: none;
color: black;
text-transform: uppercase;
font-weight: 600;
padding: 2em;
}
.top-nav img {
width: 3em;
margin-left: auto;
margin-right: .75em;
}