[RESOLVED] Multiple object with different alignment in single table cells
This might be very simple but if it is, I just can't see it.
I have a single table cell of arbitrary width and height. In that table cell I want to display an image that must be aligned with the top of the cell, with a caption below it that must be aligned with the bottom of the cell. In other words, the gap between image and caption must vary to fill up whatever space is left. Like so:
try relative and absolute positioning.
give the container (in your case, td?) relative positioning, rather than static.
after you do that, you can position the elements inside it however you want, with absolute positioning.
border:2px solid black;
Thanks. I tried that, but when I assigned absolute positioning to the caption text, it appeared positioned relatively to the page rather than to the table cell. Which confirms what is said in the page you refer to.
Hm. I can see that I need to fiddle with this. But at least it appears to be possible, which at least helps. :-)
However, I have taken the example code referred to by Moritana, and that works. So there is obviously something in my own CSS code that overrides the positioning. I am now in the process of finding out what that is, starting with the example code and working toward my own code. I am sure I will locate whatever the conflicting or overriding CSS property is.
Aha. Mystery explained, problem solved. I had not assigned a fixed height to the table cells, but I let them scale dynamically on the basis of the (varying) sizes of the images to be displayed in them. So I was trying to apply absolute positioning to objects within a cell of (at the time of rendering) variable size. Which, unsurprisingly, does not work, since there is no fixed point of reference to begin with.