|
Posted by Tomasz Chmielewski on 11/03/07 11:31
Jonathan N. Little schrieb:
> Tomasz Chmielewski wrote:
>> I noticed that Firefox ignores img height and width.
>>
>> This can be demonstrated with the simple code pasted below (or, just
>> go to http://wpkg.org/test.html).
>>
>> The code below points to a non-existing image (or an image which can't
>> be fetched).
>> In IE or Konqueror, we will see a 400px x 200px blank space.
>>
>> In Firefox and Seamonkey we just don't have any blank space (specified
>> by height and width), so website look will likely break without an image.
>>
>> Which browser's behaviour is correct?
>>
>>
>> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
>> "http://www.w3.org/TR/html4/strict.dtd">
>> <html><head><meta content="text/html; charset=ISO-8859-1"
>> http-equiv="content-type">
>> <title>test</title>
>> </head>
>> <body>
>> <table style="text-align: left; width: 100%;" border="1"
>> cellpadding="2" cellspacing="2">
>> <tbody>
>> <tr>
>> <td>
>> <img style="width: 400px; height: 200px;" alt="Image file missing"
>> src="no_such_image.jpg"><br>
>> IE will show a 400px x 200px blank space. Firefox will not show any
>> blank space, although we specified image width and height.
>> </td>
>> </tr>
>> </tbody>
>> </table>
>> <br>
>> </body>
>> </html>
>
> Since image is inline as default, if missing FF only displays the alt
> text and the "height" needed got that inline text... Want constancy, then:
> ADD
> vvvvvvvvvvvvvvv
> <img style="width: 400px; height: 200px; display: block;" alt="Image
> file missing" src="no_such_image.jpg"><br>
What's interesting, when Firefox still loads such a page (that is,
without your "display: block" tip), it displays the missing image
exactly the same as IE or Konqueror (an empty box with a given size
instead of an image).
Only when the page is fully loaded, the missing image "scales down" to
the size of "alt" text.
--
Tomasz Chmielewski
http://blog.wpkg.org
Navigation:
[Reply to this message]
|