在IE7中的定位稍微偏离(比如顶部和右侧各10px)



我有一个特定的问题,并通过很多问题寻找解决方案,但我似乎无法解决它。问题如下:

页面上有一个主要的"wrapper"div(出于居中的原因),里面有一些文本,图像和一些包含内容(页脚,页眉等)。图像使用"position: absolute",并使用CSS"top"one_answers"left"属性来偏移它们。然而,Firefox和Internet Explorer 7似乎从不同的点开始偏移,这意味着大多数图像在IE7中大约低10px,多10px

我做了什么来确保;用W3C验证器验证我的html(修复了所有问题)-试图替换位置:绝对;与某种位置:相对的;-包装器的位置已设置为position:相对位置;-我不想为IE7使用一个特定的样式表(所以没有尝试)- PS:使用meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"让我的IE8浏览器像在IE7中一样显示我的项目

我真的希望你能帮助我!提前感谢,在此我给出相应的HTML和CSS HTML:

 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
 <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/>
 <title>
 Document Title 
 </title>
 <link rel='stylesheet' type="text/css" href="includes/mainmenu/Mainmenustyle.css"/>
 <link rel='stylesheet' type="text/css" href="includes/header_main/header_mainstyle.css"/>
 <link rel='stylesheet' type="text/css" href="includes/footer_main/footer_mainstyle.css"/>
 <link rel='stylesheet' type="text/css" href="Homepagestyle.css"/>
 </head>
 <body>
 <div id="bg"></div>
 <div id="wrapper">
 <div>
 <!--#include virtual="includes/mainmenu/mainmenu.html" -->
 </div>
 <div>
 <!--#include virtual="includes/header_main/header_main.html" -->
 </div>
 <div id="about_us" class="about_us">
 <p>Some text.</p></div>
 <a href="portfolio/graphic/fotoanne.shtml" class="rollover" title="FotoAnne"><span class="displace"></span></a>
 <div id="aboutgreyhorsenl_title" class="aboutgreyhorsenl_title">
 <img src="images/aboutnl_image.png" alt="About Greyhorse"/></div>

 <div>
 <!--#include virtual="includes/footer_main/footer_main.html" -->
 </div>
</div>
</body>
</html>
CSS:

#wrapper{
position:relative;
z-index: 1;
margin:10px auto;
width:1100px;
}
#bg {
   width: 100%;
   height: 614px; 
   position: absolute;
   top: 93px;
   left: 0;
   background-image: url(images/stripe.png);
   background-repeat: repeat-x repeat-y;
   background-attachment: scroll;
} 
body {
background-image:url(images/Background_Homepage.png);
background-attachment: scroll;
background-repeat: repeat-x;
background-position: top;
font-family: arial;
color: #111111;
font-size: 0.75em; /* 12px/16=0.75 em */
word-spacing: 2px;
line-height: 175%;
}
.about_us {
display: block;
width: 420px;
height: 12px;
position: absolute;
left:290px;
top:-110px;
}
.aboutgreyhorsenl_title {
position: absolute;
top: 280px;
left: 400px;
}
a.rollover {
display: block;
width: 155px;
height: 115px;
text-decoration: none;
background: url("images/FotoAnne_thumbnail.png");
position: absolute;
left:735px;
top:-100px;
}
a.rollover:hover {
background-position: 775px 0;
}
.displace {
position: absolute;
left:287px;
top:-205px;
}

再次提前感谢任何可以帮助我的人!

来自html5boilerplate的style.css文件将使所有浏览器具有相同的'默认'设置。将这个CSS文件添加到您的站点(作为第一个要加载的),可能会解决这个问题。

http://html5boilerplate.com/

最新更新