DIV为什么在IE6下不能对齐

来源:百度知道 编辑:UC知道 时间:2024/05/29 07:38:41
下边是代码 请帮忙看一下 是不是哪里不对

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
<!--
#top {
height: 200px;
width: 952px;
margin-right: auto;
margin-left: auto;
background-color: #000000;
}
.top_menu {
background-color: #0066FF;
width: 952px;
height: 30px;
margin-bottom: 1px;
}
.top_lf {
float: left;
width: 250px;
background-color: #

.top_menu {
background-color: #0066FF;
width: 952px;
height: 30px;
margin-bottom: 1px;
}

里的margin-bottom: 1px;
ie6里里面的div有margin-top或margin-bottom,外面的div向下也有相应的margin-bottom值。不信你把margin-bottom: 1px;变成margin-bottom: 10px;看看效果。

这是ie6的bug

如希望有1px可以用border-bottom:1px solid #000;
用margin-bottom: 1px;时,#top的height: 200px;去掉 不要定义高,用display:block;试试。背景用body定义。