Disappearing images or avatars in tables in chrome?

A ‘funny’ recently presented itself.   In the chrome browser, avatars were not showing up, despite they being there in the html code.

My first thought when I hear of browsers responding differently is to check html validation – browsers often cope with errors but sometimes not.

In this case, it was the css that turned out to be the problem.

An invaluable tool to debug these things is the ‘inspect element’ firebugs or chromes and the ability to deselect or add css to see what is overriding what.  See http://bigemployee.com/4-simple-techniques-to-quickly-debug-and-fix-your-css-code-in-almost-any-browser/

Fairly quickly one could see that somehow the inline attributes were being overwritten.

Image attributes overwritten

Image attributes overwritten

Scrolling back up through the css to see what might be overwriting that css, I paused thoughtfully at a image max-width and unticked and  reticked some css.

As soon as I unticked the max-width the images reappeared in chrome.

Undo Max Width

Undo Max Width

 

A quick web search showed that others had encountered this before and had some suggestions on overcoming this.  It seems Chrome interprets the rule differently from Firefox. It assumes the image can freely be shrunk, and with a long string of text in the cell next door, it squeezes the images.

So some possible solutions appear to be:

  • remove the max-width attempt to be responsive, or
  • set a fixed table width
  • maybe set a fixed column width