Center horizontally and vertically an absolute positioned element without knowing the size [duplicate]
问题 This question already has answers here : Center text over an image in flexbox (6 answers) Closed 3 years ago . I don't even know if this is possible using CSS only, but I have to ask. PLEASE, read the specs before you provide an answer, accordingly. Thank you! My markup: <div class="wrapper"> <img src="http://placehold.it/350x150"> <p>Some text random size</p> </div> Obviously, .wrapper will have the height of my img element, if that's a block. Then, I need the p element to be centered