gpt4 book ai didi

html - IE 8 忽略 div 中的边距

转载 作者:行者123 更新时间:2023-11-28 13:27:01 25 4
gpt4 key购买 nike

我在让 IE8 识别边距时遇到问题,我有一个 Logo ,我想在带有左边距的页眉 div 中垂直居中,但它似乎被忽略了,但在 Chrome、Firefox 和 Safari 中显示正常。我还有一个登录/注册 div,它应该位于标题 div 的右上角,并带有一些顶部和右侧的边距,但它们也被忽略了。我将在本文中包含 JSFiddle 链接和代码。这是它在 IE 中的样子 enter image description here这是它应该的样子 enter image description here

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;
}​

最佳答案

以下是我为可能遇到相同问题的人做错的事情我忘记添加 !DOCTYPE 一位用户建议这样做,但由于某种原因该帖子已被删除。

我在 DOC 开头遗漏的内容:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

关于html - IE 8 忽略 div 中的边距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13329803/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com