html
<body>
<header>
<div class="indexHeaderWall" id="headerLeftWall">
</div>
<img id="profilePic" src="icons/myPicture.jpg" alt="Picture of Daniel Campos">
<div class="indexHeaderWall" id="headerRightWall">
</div>
</header>
</body>
css
body {
background-color: aqua;
margin: 0%;
}
header {
background-color: orange;
display: flex;
position: relative;
}
#profilePic {
position: absolute;
left: 25%;
top: 0%;
bottom: 0%;
margin: auto 0%;
}
.indexHeaderWall {
background-color: aliceblue;
height: 300px;
border: solid red 1px;
}
#headerLeftWall {width: 30%;}
#headerRightWall {width: 70%;}
I experimented with using percentages for image centering, but encountered difficulties as the window size decreases.
The left div occupies 30% of the width, leaving the remaining space for the right div.
If you have any suggestions on how to effectively center an image on a split like this regardless of its size, please share your insights or modifications to the code provided!
Thank you for your assistance!