I have a <table> and I wish to display an <img> over the <table> in the exact center.
How would I do that?
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.
If the dimensions of the image are fixed (say, width 200 height 300), then something like this should work:
HTML:
CSS:
The containing
#table-and-image-containerwill be the size of the table, sinceposition: absolutewill take#the-imageout of the sizing algorithm anddisplay: inline-blockwill reduce the width to the width of the table instead of 100% of the container. Then you use standardtop/left/margintricks to position the image in the center, and usez-indexto make sure it goes on top.