When I have an image right next to text in a table cell, why does the text start at the baseline of the image?
I’d had enough of this problem. It seemed stupid to have two table cells, one for an image and one for some text that was right next to each other. But every time I put an image right next to some text in a cell, the text aligned at the bottom edge of the image.
After some research, I found a “new to me” attribute for the image tag, Align. The align attribute will take care of that problem with the text and the image.
Here is the traditional image next to some text;
See what happens? It aligns to that bottom edge.
But if you add an “align” property to the image tag like this;
<img src=”/images/design/html/indy.jpg” align=”absmiddle”/>
This is what that thumbnail does now;
See what happens? Now it aligns in the middle.
Now, I am not sure what the difference is between the “absmiddle” and “middle” declaration of that property, but when I was using them the other day with two sets of text and images in cells next to one another, with the same sized thumbnail icons, the thumbnails were not on the same like, but were off one pixel when I used the “middle” declaration.
Here is the same example with “middle” set for align;
It seems to align pretty much the same as absmiddle.
Try it out, either way it is a nice little code saver and very useful on a day to day basis.
Here are some similar arcade posts
- Using images on a regular HTML input button
- A bugs in IE 5.0 with the use of text-transform and font in the same declaration.
- How to use float to get a gallery of thumbnails to evenly space each other.
- Which should I use, relative or absolute positioning?
- Wrap text around your arcade images
If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.











Comments
No comments yet.
Leave a comment