當我在下面的代碼中添加margin
到.child
時,IE8忽略它。在現代瀏覽器中,相同的代碼按預期工作。這是什麼造成的?爲什麼IE8會忽略子元素的邊距?
<html lang=「de「 xml:lang=「de「 xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv=「Content-Type「 content=「text/html「; charset=「iso-8859-1「 />
<title></title>
<style>
.parent {
margin: 5px;
border: 10px solid blue;
position: relative;
}
.child {
margin: 10px;
border: 10px solid red;
padding: 4px;
}
</style>
</head>
<body>
<div class="parent">
<p class="child" style="width:80%; position:relative; left:10px; top:10px; background-color:yellow;">I'm the CHILD!
<span id="textOutput"></span>
</p>
</div>
</body>
</html>
IE8不是現代瀏覽器:) –
請包括完整的代碼(包括HTML)。無法使用提供的樣式重現此操作。 –
好的!我更新了我的代碼!請大家,再檢查一次! –