如何解决IE div定位问题
| 我在弄清楚为什么IE将我的侧边栏div对准页面中心时遇到了麻烦。这仅在索引页面上发生,对于所有其他部分,它都位于正确的位置。 这是我的CSS的body / sidebar部分:body {
background-image: url(\'../images/easy-tile.gif\');
text-align: center;
font-family: Helvetica,sans-serif;
background-color: #F2F9D7;
margin: 0px;
padding: 0px;
line-height: 90%;
font-family: \"Gill Sans\",Tahoma,Verdana,Arial,sans-serif;
}
div.sidebar {
border-color: #1c664f;
line-height: 1em;
border-style: solid;
border-width: 2px;
background-size: 100%;
background-repeat: no-repeat;
moz-border-radius: 15px;
border-radius: 15px;
margin-left: 14px;
position: absolute;
text-align: center;
margin-top: 20px;
padding: 15px 15px 15px 15px;
background-color: #679847;
width: 175px;
color: #FFFFFF;
}
HTML:
<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">
<html>
<head>
<link rel=\"stylesheet\" type=\"text/css\" href=\"css/index_style.css\" />
<title>Title</title>
<SCRIPT LANGUAGE=JavaScript1.1>
<!--
var MM_contentVersion = 6;
var plugin = (navigator.mimeTypes && navigator.mimeTypes[\"application/x-shockwave-flash\"]) ? navigator.mimeTypes[\"application/x-shockwave-flash\"].enabledPlugin : 0;
if ( plugin ) {
var words = navigator.plugins[\"Shockwave Flash\"].description.split(\" \");
for (var i = 0; i < words.length; ++i)
{
if (isNaN(parseInt(words[i])))
continue;
var MM_PluginVersion = words[i];
}
var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}
else if (navigator.userAgent && navigator.userAgent.indexOf(\"MSIE\")>=0
&& (navigator.appVersion.indexOf(\"Win\") != -1)) {
document.write(\'<SCR\' + \'IPT LANGUAGE=VBScript\\> \\n\'); //FS hide this from IE4.5 Mac by splitting the tag
document.write(\'on error resume next \\n\');
document.write(\'MM_FlashCanPlay = ( IsObject(CreateObject(\"ShockwaveFlash.ShockwaveFlash.\" & MM_contentVersion)))\\n\');
document.write(\'</SCR\' + \'IPT\\> \\n\');
}
if ( MM_FlashCanPlay ) {
window.location.replace(\"indexflash.html\");
} else{
window.location.replace(\"indexnoflash.html\");
}
//-->
</SCRIPT>
</head>
<body>
<div class=\"wrapper\">
<div class=\"header\">
</div>
<div class=\"navigation\">
<ul>
<li><a href=\"index.html\">Home</a></li>
<li><a href=\"reviews.html\">Reviews</a></li>
<li><a href=\"guestbook.html\">Guestbook</a></li>
<li><a href=\"http://search.barnesandnoble.com/4 target=\"_blank\">Buy the Book</a></li>
<li><a href=\"contact.html\">Contact</a></li></ul>
</div>
<div class=\"sidebar\">
<a href=\"987294\" target=\"_blank\"> <img src=\"images/cover.jpg\" id=\"cover\"/>
</a><br /><a href=\"http://search.barnesandnoble.com/\" target=\"_blank\">BUY THE BOOK!</a>
<p>\"Quote\" <br /><br />— Senator Bob Dole</p>
<a href=\"http://www.com\" target=\"_blank\"><img src=\"images/2.jpg\" id=\"linda\"/></a><br />
<p><a href=\"http://www.facebook.com/pages/\" target=\"_blank\"><img src=\"images/facebook.png\" id=\"icons\"/></a>
<a href=\"http://twitter.com/#!\" target=\"_blank\"><img src=\"images/twitter.png\" id=\"icons\"/></a>
<a href=\"http://39.net/feed/\" target=\"_blank\"><img src=\"images/rss.png\" id=\"icons\"/></a></p>
</div>
<div class=\"flash\">
<OBJECT classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,79,0\" WIDTH=\"640\" HEIGHT=\"480\" id=\"SWFMovie\"> <PARAM NAME=movie VALUE=\"movie_opt.swf\"> <PARAM NAME=wmode VALUE=transparent> <PARAM NAME=quality VALUE=GOOD>
<embed src=\"movie_opt.swf\" quality=\"high\" WIDTH=\"640\" HEIGHT=\"480\"></object>
</div>
<div class=\"main\">
<p>blah</p>
</div>
</div>
<span id = \"copyright\">
<p>© 2011. All rights reserved.</p>
</span>
</body>
</html>
我一直都在使用Firefox / Chrome测试该网站。现在,我可以看到为什么人们如此讨厌IE对CSS的处理。
有人知道为什么会这样吗?
谢谢。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。