I'm facing a challenge that seems simple, but I just can't seem to crack it.
Here's the HTML snippet in question:
<div class="product">
<img src="product123.png" />
</div>`
Accompanied by the following CSS:
.product {
width: 460px;
height: 460px;
}
.product img {
margin: auto;
display: block;
}
The image aligns horizontally just fine, however, vertical alignment is proving to be tricky. I attempted using position: relative; / bottom: 0;
, but to no avail...
Any solutions or ideas are greatly appreciated!
Thank you for your input!
PS: While I stumbled upon this solution center <IMG/> inside a <DIV> with CSS, I prefer not to alter my current HTML structure and would like to find a resolution on my own terms.