How to align text directly under picture inside td | Sololearn: Learn to code for FREE!


How to align text directly under picture inside td Above is the link of the page I'm unable to format properly. The images and the text below them are inside a 3 row, 3 column table. I would like to restrict the text width to the image width. PLEASE HELP. It's driving me crazy and I know it must be something pretty simple.

7/12/2017 2:07:00 PM


4 Answers

New Answer


I cannot look at and test now, but what I would try is: + set the 'table-layout:fixed' css property/value to the <table> element + specify the width of the first row cells to be equal to the pictures width (plus eventual borders, margins, padding... obviously ^^) Normaly, this will be enough to constraint cell size and not allowing them to grow regarding the cell text content ;)


Have you tried cropping the images? The text should be floating on its own directly under the images. If that doesn't work try to position it via css


Awesome! I'll try your suggestions. Thank you both! I'll let you all know what works.


I got the page to look as I wanted now, by adding padding to the table cells. Before I had the images and the text on separate cells. I now have them in one cell together and added padding. The text now line perfectly under the image. Thank you for your help!