Why does Opera 9 have a space between these two im

2019-03-02 14:58发布

问题:

Every other browser is rendering this correctly.

<body>
    <div>
        <div><img src="img/logo_top.png" width="168" height="85" alt="Logo top" /></div>
        <div><img src="img/logo_bottom.png" width="168" height="83" alt="Logo bottom" /></div>
    </div>
</body>

It's the same thing without the divs, and with a < br /> between images.

Update:

Here is my HTML, with doctype:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
    <head>
        <title>Test</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <style type="text/css">
            img {border: none;}
            body {font-size: 0px;}
        </style>
    </head>
    <body>
        <div>
            <div><img src="img/logo_top.png"  alt="Logo top" /></div>
            <div><img src="img/logo_bottom.png" alt="Logo bottom" /></div>
        </div>
    </body>
</html>

回答1:

If it's the issue I think it is, it should be fixed if you add this CSS:

img {
    vertical-align: top
}

Or this:

img {
    display: block
}


回答2:

Try removing the whitespace between the first </div> and the second <div>. Sometimes these CRLF whitespace characters are interpreted by the browser as an indication of physical space.