IE 上的 CSS 与 Google Chrome 上的 CSS

标签 css internet-explorer google-chrome

我只是使用了以下技术:

http://webdesign.about.com/od/css3/f/blfaqbgsize.htm

无论我做什么,都试图让背景图片成为页面的确切大小,它在 Google Chrome 中工作正常,但在 IE 中却不行。他们提供的示例在 IE 和 GC 中运行良好,但我看不出这两个站点有什么不同。这是我的代码:

<!DOCTYPE html  PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html>      <head>      <title>             National Balloon Festival!      </title>        <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>       <style type="text/css">             html, body {
                height: 100%;
                margin: 0;
                padding: 0;             }           img#bg {
                position:fixed;
                top:0;
                left:0;
                width:100%;
                height:100%;            }           #content {
                position:relative;
                z-index:1;
                top:0px;
                left:0px;           }       </style>        <!--[if IE 6]>      <style type="text/css">             html { overflow-y: hidden; }            body { overflow-y: auto; }          img#bg { position:absolute; z-index:-1; }           #content { position:static; }       </style>        <![endif]-->    </head>     <body style=''>         <body>          <img src="images/Field1.jpg" alt="background image" id="bg" />          <div id="content">All your content here - including headers, paragraphs, etc.</div>         </body>





</body> </html>

最佳答案

嗯,当我使用您的代码(带有我自己的图片)时,一切似乎都很好。我很好奇,您使用的是哪个版本的 IE?

关于IE 上的 CSS 与 Google Chrome 上的 CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5914955/

相关文章:

html - 图片放置,并正确标记h1和h2元素

javascript - 高度 : auto calculating incorrectly if element is hidden when dom loads, 然后稍后显示

与 FF 和 IE 相比,jQuery 在 Chrome 中返回错误的元素位置

javascript - IE9 和 10 不反射(reflect) javascript 光标更改

javascript - Web 推送 201 但在设备上看不到通知

html - 如何让 html 内容在初始 View 之外重复/加载?

html - 如何通过编码在 Internet Explorer 中启用兼容性 View

html - 如何让 Jumbotron 图像随屏幕调整大小?

internet-explorer - IE Com 对象,方法 .Navigate 和 .Navigate2 之间的区别

javascript - iframe 中的表单无法通过 Angular 和 IE11 重新获得焦点