how do i vertically center an img in this given situation?
I’ve been trying to follow the code in the following link but perhaps because of the way divi builder and the current layout is setup its not working.
https://designpieces.com/2012/12/vertical-centering-image-in-a-div/
4
Answers
You can set the parent to
position: relative
then absolutely position the image withleft: 50%; top: 50%; transform: translate(-50%,-50%);
to put it in the center.You can also use flexbox with
justify-content: center; align-items: center;
to center the image in the middleCheck out this fiddle: https://jsfiddle.net/NayanaDas/gs7nxnms/. Add this css:
Solution using
flex
property