I have a webpage in which, at the vertical center of the screen, there are three elements which should be placed evenly: an "about" link, a logo depicting an N letter, and a "music" link.
I want the elements to be placed evenly. Here's the CSS I applied to the parent container element:
.container {
display: flex;
align-items: center;
place-content: space-evenly;
height: 100%;
width: 100%;
margin: auto;
}
This is the HTML for the inner elements:
<div class="container">
<a href="...">About</a>
<img style="width: 65px; height: 65px;" src="img/n.png" />
<a href="...">Music</a>
</div>
The result looks like this:
However, it appears to me there is some difference in the number of pixels that the links "About" and "Music" have from the middle of the page. It varies across different screen resolutions, but there are up to 5px differences in the distance that "Music" and "About" have from the central "N" image, the former being the closer one to the center.
I don't understand what this offset is coming from, but I suspect it may be due to the fact that the texts for the two links have slightly different widths, and the flex placing at even distances from the page margins, and not from the center.
This codepen demonstrates the issue: https://codepen.io/samul-11/pen/jOvwWQE
If that's the case, how do I obtain the result I described, in which the links have same distance from the middle of the page?