Impose an empty frame as a replacement for an image
How can I force an empty frame of specified size in html if an image is not found ? for example, suppose I have an image i开发者_StackOverflow社区 know to be 100x100, but the image is not found at the specified url. yet, I would still like to have an empty frame 100x100.
I tried setting <img src="whatever" width="100" height="100" />
, as well as via css, but it does not work. if the image is not found, nothing is displayed.
Add the css property display: inline-block
to the image. If you need to support older browsers, then you need to use block instead of inline-block.
精彩评论