开发者

Impose an empty frame as a replacement for an image

开发者 https://www.devze.com 2022-12-21 00:33 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消