开发者

Why does Opera 9 have a space between these two images?

开发者 https://www.devze.com 2023-02-12 16:56 出处:网络
Every other browser is rendering this correctly. <body> <div> <div><img src="img/logo_top.png" width="168" height="85" alt="Logo top" />

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/lo开发者_Go百科go_bottom.png" alt="Logo bottom" /></div>
        </div>
    </body>
</html>


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
}


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.

0

精彩评论

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