After setting the width and height for an image, along with testing overflow:hidden
, I've encountered an issue where the alt
text for a broken image overflows the bounds of the image and the image size is lost. How can I contain the alt
text within the image box?
img{
width:100px;
height:100px;
border:1px solid #ff0000;
overflow:hidden;
}
<img src="http://www.example.com/broken.jpg" alt="This is a long text which overflows bounds of image">