开发者

positioning in IE7 slightly off (like 10px top and right)

I have a certain problem and searched through a lot of questions to find a solution but I just can not seem to fix it. The problem is as following:

There is the main "wrapper" div on the page (for centering reasons), and inside this is some text, images and a number of includes (footer, header etc.). The images are using "position: absolute" and using the CSS "top" and "left" property to offset them. However, Firefox and Internet Explorer 7 seem to start their offset from a different point, meaning the most of the images are just about 10px lower and 10px more to the right in IE7

What I've done to make sure; - validated my html with the W3C validator (fixed everything) - tried to replace position:absolute; with some position:relative; - The position of the wrapper has been set as position:relative; - would rather not want to work with a a specific stylesheet just for IE7 (so didn't try that) - PS: used meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" to let my IE8 browser shows my project like it was in IE7

I'm really hoping you could help me out! Thanks in advance and hereby i'm giving the corresponding HTML and 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: b开发者_开发技巧lock;
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;
}

Thanks in advance again for anyone who could help me out!


the style.css file from the html5boilerplate will make all browsers have the same 'default' settings.. adding this css file to your site (as the first one to be loaded), might fix the issue.

http://html5boilerplate.com/

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜