Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I wrap img alt text?

I have an image set by css style to 100x75. When it doesn't load, the alt text loads into the space, but expands the container to beyond 100px width.

How can I prevent this? Either by cutting it off or wrapping it.

like image 319
Khan Avatar asked Apr 28 '10 16:04

Khan


People also ask

How do I wrap text around an image HTML?

Use the markup code <BR CLEAR=”left” /> to flow text around images on opposite sides of your Web pages.

Can you embed alt text in an image?

Alt text can be read by screen readers, and helps people who are blind or who have low vision understand what images and other objects are in a document. You can add alt text to objects, such as pictures, clip art, charts, tables, shapes, SmartArt, embedded objects, and audio or video objects.

How long should alt text be for images?

Essentially, alt text should be as long as it needs to be in order to effectively describe the content, but should be succinct. For complex images such as charts, graphs, and diagrams that require more lengthy descriptions, there are other options.


2 Answers

Well, I figured it out to some degree. I just wrapped the image in a container of the same size. I guess my browser (Firefox) was not wrapping the text because it was an inline element.

Thanks everyone for your responses.

like image 196
Khan Avatar answered Oct 22 '22 14:10

Khan


Alternatively:

  • you can use overflow: hidden; to the image. It will hide the alt text that crosses the image border. Though it will not wrap the text.
  • also, reduce the alt text size.

 

#idlogo img {    
    overflow: hidden;
    font-size: 10px;
}

The purpose of alt Text is to let the screen reader know about the image, so I think reducing the alt text size and hiding the overflow should work out best. But, of course avoid using very long text.

like image 41
mangalbhaskar Avatar answered Oct 22 '22 15:10

mangalbhaskar