How can I align text in the vertical middle of a Div element provided it has a position:absolute property specified?
Setting display:table-cell; vertical-align:middle; isn’t working.
Thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Wrap an inner div and give it
position:relative; top:-50%;in addition to giving the absolute atop:50%.Though of course if it’s complicated styling, please provide your CSS.
You can get away with
line-heightif it’s just a single line of text, you’d have to kill theabsoluterule though.