Streaming live at 10am (PST)

How both overlap and vertically center two elements?

I’m a beginner with Webflow, so sorry–

I’m trying to position text OVER a picture. Both are within a div. I can do this by selecting absolute positioning for the text. Now I would also like to vertically center the text within the div. The only way I can find to do this is to make the div a flex object. However, the vertical alignment option that this gives the text element apparently doesn’t work if the text has absolute positioning. It works if I switch the text to relative positioning (for example) but then the text will not overlap the picture in the div–they just go side by side.

So, how do I both overlap and vertically center two elements?


Make the picture a background image to the parent div. Then it will work. You can also just make the image absolute positioning and then set a higher z index for the text element. The first option is usually better though.