IE上的CSS与Google Chrome上的CSS
我只是使用了以下技巧: 无论我做什么,都要尝试将背景图片设置为页面的精确大小,这在Google Chrome中效果很好,但在IE中没有。他们提供的示例在IE和GC中效果很好,但我看不出这两个站点有什么不同。这是我的密码:IE上的CSS与Google Chrome上的CSS,css,internet-explorer,google-chrome,Css,Internet Explorer,Google Chrome,我只是使用了以下技巧: 无论我做什么,都要尝试将背景图片设置为页面的精确大小,这在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"> <ht
<!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>
全国气球节!html,正文{
身高:100%;
保证金:0;
填充:0;}img#bg{
位置:固定;
排名:0;
左:0;
宽度:100%;
高度:100%;}#内容{
位置:相对位置;
z指数:1;
顶部:0px;
左:0px;}此处显示所有内容-包括标题、段落等。
嗯。。。显然,将定位更改为“绝对”可以使其位于顶部。嗯。。。显然,将定位更改为“绝对”可以让它位于顶部。嗯,当我使用您的代码(带有我自己的图片)时,一切似乎都很好。我很好奇,你使用的是什么版本的IE?嗯,当我使用你的代码(有我自己的图片)时,一切似乎都很好。我很好奇,你用的是什么版本的IE