1

我无法让 IE8 识别页边距,我有一个我想要垂直居中在一个带有左边距的标题 div 中的徽标,但它似乎被忽略但在 Chrome、Firefox 和 Safari 中显示良好。此外,我有一个登录/注册 div,它应该位于标题 div 的右上角,并带有一些顶部和右侧边距,但它们也被忽略了。我将在这篇文章中包含 JSFiddle 链接以及代码。这是它在 IE 在此处输入图像描述 中的样子 这是它应该看起来的样子 在此处输入图像描述

JSFiddle http://jsfiddle.net/ARhRt/

<html>
    <head>
        <title>
        TESTING    
        </title>
        <LINK href="CLLProfile.css" rel="stylesheet" type="text/css">


    </head>

    <body>
        <div id="wrapper">
        <div class="container">

            <div id="header">
                <img src="http://www.placekitten.com/400/100">

                <div class="login"> 
                    <a href="http://www.signup.com">Sign Up</a> <a href="http://www.login.com">Login</a>
                </div>

                <div class="search">
                    <form id ="search" action="" method="post" enctype="multipart/form-data">
                        <label>Search:</label>
                        <input type="text" name="searchBox" id="searchBox" /> 
                        <input type="submit" id="Submit" value="Submit" />
                    </form> 
                </div>

            </div>

            <div class="navigation">
                <form id ="categoryForm" action="test1.php" method="post">
                    <div id="categorydiv">
                        <select name="thing" onChange="getSub(this.value)">
                            <option value=0>Select Main Category<?=$options?>
                        </select> </div>

                    <div id="subcategorydiv">
                        <select name="subCats" >
                             <option>Select Sub Category</option>
                        </select></div>

                        <input type="submit" value="Submit" />
                </form>

            </div>

                <div class="content">
                    Here is the CONTENT 
                    <div class="profileInfo">
                        PROFILE INFO
                    </div>
                </div>

        </div>

        </div>
    </body>

</html>​

CSS:

body{
    background: gainsboro;
    text-align: center;

}

.container{
    padding-top: 20px;
    background: gold;
    width: 900px;
    height: 1300px;
    margin: 0 auto;

}

.content {
    background: #aad500;
    width: 800px;
    height: 1000px;
    margin: 0 auto;
    border: black solid medium;
    text-align: left;
}

#header {

    width: 800px;
    height: 150px;
    margin: 0 auto;
    background: #aad500;
    border: black solid medium;
    text-align: left;

}

#header img{
    position: relative;
    left: 50px;
    top: 25px;


}

.login {
    width: 350px;
    height: 35px;
    float: right;
    background: #aad500;

}

.search{
    background: #aad500;
    color: white;
    width: 250px;
    height: 20px;
    position: relative;
    margin-top: 10px;
    margin-left: 500px;
}

.profileInfo{
    background: whitesmoke;
    width: 750px;
    height: 800px;
    margin-top: 50px;
    margin-left: auto;
    margin-right: auto;


}

.login a{
    float: right;
    margin-left: 10px;
    margin-right: 20px;
    margin-top: 5px;
    font-size: large;
    color: whitesmoke;
    text-align: right;

}

.login a:hover{
    color: green;
}

.navigation {
    background: green;
    width: 800px;
    height: 50px;
    margin: 0 auto;
    border: black solid medium;
    text-align: left;
}

.navigation select{
    float: left;
    margin-top: 15px;
    margin-left: 10px;
}

.navigation input {
    margin-left: 10px;
    margin-top: 15px;
}

.search #Submit{
    float: right;
    position: absolute;
}

#wrapper{
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}​
4

1 回答 1

2

对于可能遇到相同问题的人,这是我做错的事情,我忘了添加!DOCTYPE 一个用户提出了这个建议,并且由于某种原因该帖子被删除了。

我在 DOC 开头留下的内容:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">
于 2012-11-11T09:06:52.390 回答