How to center elements

You can always center verticaly using the following sweat feature!

Let’s say you have a 500px height block in which you want to have a 200px image to be centered verticaly. Make that block position: relative and the image position: absolute; Image should have top: 50% (notice the %-sign). Now on the right panel scroll to transforms and move the image 50% up.

Quick explanation:

When you make the parent object position: relative; you can then use absolute positioning for child elements that are within this block. Using top: 50% on the child element will move the image down 50% of the parent element’s height. When you use the transform section to move element 50% up it will move the child element up 50% of its height :slight_smile:

6 Likes