Pergunta

I have two images in the html email. When images are not displayed, the alt text is expected to be shown. Right?

  <img src="invalid url" border="0" alt="AAA BBBB AAA BBBB 123456789" style="width:237px;height:100px;">
  <img src="invalid url" border="0" alt="AAA BBBB AAA BBBB 1234567890" style="width:237px;height:100px;">

However, when the text is longer than the dimensions of the image, it is not displayed at all. As result, it is displayed for the first image and not displayed for the second one. Is there any way to display the text in several lines if it is longer, or to display the first part of the text?

Added: this happens for Google Chrome. For the Firefox the alt is displayed.

Foi útil?

Solução 2

Assuming you can break alt text in new line (meaning it's not generated dynamically) a simple idea to have alt text in new line is :

<img src="foo.jpg" alt="Line 1
Line 2" /> <br > // new line here is next line for alt text

So for your case :

<img src="invalid url" border="0" alt="AAA BBBB 
AAA BBBB 
123456789" style="width:237px;height:100px;">

Reference : Newline in alt text

Outras dicas

There is nothing wrong in your code, This might be bug in webkit (Source). Chrome, Safari and other webkit browsers will not show you the alt text. There is nothing you can do for this. Even if you try with title attribute, it will not work.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top