-1

我在使用 IE9 时遇到问题,并且我也假设为 8 及以下版本。下面是我的.CSS。它在 Chrome、Safari 和 FireFox 中完美运行。我试图避免为 IE 创建单独的 .CSS。抱歉,这是我第一次发帖,如果您需要更多信息,请告诉我。

body {
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 0.8em;
    background-image: url('../images/white_side.jpg');
}
#container {
    width: 1280px;
    margin: 0 auto;
    margin-top: -10px;
    align: center;
}
#masthead {
    width: 100%; 
    height: 170px;
    background-image: url('../images/header.jpg');
    background-repeat: no-repeat;
}
#content {
    float: left;
    width: 100%;
    background-image: url('../images/background.jpg');
    background-repeat: no-repeat;
}
#footer {
    text-align: center;
    clear: both;
    width: 100%;
    padding-top: 5px;
    padding-bottom: 5px;
    border-top: 1px solid #a9a9a9;
    border-bottom: 1px solid #a9a9a9;
}
#footer p {
    color: #DD7500;
    margin-top: 5px;
}
#footer a {
    color: #DD7500;
    text-decoration: underline;
}
#footer a:hover {
    color: black;
    text-decoration: none;
}
#menu{
    float: left;
    list-style-type: none;
    margin-top: 95px;
    margin-left: -40px;
}
#home{
    float: left;
    list-style-type: none;
}
#post{
    float: left;
    list-style-type: none;

}
#input{
    float: left;
    list-style-type: none;
    margin-left: 100px;
    margin-top: 15px;
}
#search{
    width: 210px;
    -moz-border-radius:6px;
    -webkit-border-radius:6px;
    border-radius:6px;
}
#deals{
    float: left;
    list-style-type: none;
    margin-left: 90px;
}
#login{
    float: left;
    list-style-type: none;
}
#registrationul{
    float: right;
    list-style-type: none;
    margin-top: -20px;
}
#welcome{
    float: left;
    list-style-type: none;
}
#register{
    float: left;
    list-style-type: none;
}
#loginContainer {
    position:relative;
    float:right;
    font-size:12px;
}
#loginButton { 
    float:right;
    position:relative;
    z-index:30;
    cursor:pointer;
}
#loginButton img {
    color: white;
    font-size:24px; 
    background-image:url(../images/login.jpg) no-repeat ;
}
#loginButton:hover {
    background-image:url(../images/loginafter.jpg);
}
#loginBox {
    position:absolute;
    top: 70px;
    right: 0px;
    display:none;
    z-index:29;
}
#loginForm {
    width:248px; 
    -moz-border-radius:3px 0 3px 3px;
    margin-top:-1px;
    padding:6px;
}
#loginForm fieldset {
    margin:0 0 12px 0;
    display:block;
    border:0;
    padding:0;
}
fieldset#body {
    background-color: rgba(0,0,0,0.4);
    -moz-border-radius:3px;
    padding:10px 13px;
    margin:0;
}
#body label {
    color: white;
    margin:9px 0 0 0;
    display:block;
    float:left;
}
#loginForm #body fieldset label {
    display:block;
    float:none;
    margin:0 0 6px 0;
}
#loginForm input {
    width:92%;
    border:1px solid #899caa;
    border-radius:3px;
    -moz-border-radius:10px;
    color:#3a454d;
    font-weight:bold;
    padding:8px 8px;
    box-shadow:inset 0px 1px 3px #bbb;
    -webkit-box-shadow:inset 0px 1px 3px #bbb;
    -moz-box-shadow:inset 0px 1px 3px #bbb;
    font-size:12px;
}
#loginForm #login {
    width:auto;
    float:left;
    color:black;
    padding:7px 10px 8px 10px;
    box-shadow:none;
    -moz-box-shadow:none;
    -webkit-box-shadow:none;
    margin:0 12px 0 0;
    cursor:pointer;
    padding:7px 2px 8px 2px; /* IE7 Fix */
}
#loginForm span {
    background-color: rgba(0,0,0,0.4);
    text-align:center;
    display:block;
    padding:7px 0 4px 0;
}
#loginForm span a {
    color:white;
    font-size:12px;
}
#rightpannel{
    float: right;
    margin-top: 20px;
    margin-right: 20px;
    width: 600px;
    height: 350px;
    background: rgba(0, 0, 0, 0.5);
}
#bottompannel{
    margin-top: 400px;
    margin-left: 20px;
    width: 1240px;
    height: 200px;
    background: rgba(0, 0, 0, 0.5);
}
#leftpannel{
    float: left;
    margin-top: 20px;
    margin-left: 20px;
    width: 600px;
    height: 350px;
    background: rgba(0, 0, 0, 0.5);
}
4

3 回答 3

0

你永远不会让 IE 尝试像其他更现代的浏览器那样运行而没有 doctype。现代网页需要文档类型,如果没有文档类型,您将处于怪癖模式。将此添加为您的第一行:<!DOCTYPE html>

于 2012-05-01T03:30:50.220 回答
0

您忘记在导航菜单中清除浮动...

<ul id="registrationul">
  <li id="welcome"></li>
  <li id="register"><a id="userButton" href="register.php"><img onmouseout="hideIt(this, 'images/register_plain.jpg')" onmouseover="showIt(this, 'images/register_hover.jpg')" id="imageshow6" alt="" src="images/register_plain.jpg"><em></em></a></li>
</ul>
<div style="clear:both;"></div><!-- clears floated elements (in this case ul#menu and ul#registrationul) -->
于 2012-05-01T03:27:01.323 回答
0

IE 解析器的容错性远不如 Webkit (Chrome / Safari) 或 Gecko (Firefox)。通过验证服务运行您的代码。很有可能,您忘记在某处关闭标记会弄乱标记(我是根据个人经验说的)。

于 2012-05-01T02:34:28.040 回答