3行div高度自适应 兼容火狐

来源:百度知道 编辑:UC知道 时间:2024/05/30 02:44:32
小妹跪求各位大侠,一下是一个总的div包含3行并列的div,第一个和第三个div高度已定,中间div高度随内容变化而变高度,下面是代码,在IE下可以,在火狐中三行div之间有缝隙?怎么消除缝隙,使高度自适应,同时兼容火狐,谢谢!
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>div高度自适应</title>

<style type="text/css">
<!--
#main {

background-color: #FF0000;
height: 100%;
width: 500px;
}
#main #top {
height: 100px;
width: 500px;
background-color: #FFFF00;
}
#center {
height: 100%;
width: 500px;
background-color: #00FF66;
}
#footer {
width: 500px;
background-color: #0000FF;
height: 100px;
}
-->
</style>
</head>

<body>
<div id="main">

<div id="top"></div>

<div id="center">
<p>888 </p>
<p&g

加上*{padding:0;margin=0;}消除边距造成的影响

<title>div高度自适应</title>

<style type="text/css">
<!--
* { padding:0; margin:0;}
#main {

background-color: #FF0000;
height: 100%;
width: 500px;
}
#main #top {
height: 100px;
width: 500px;
background-color: #FFFF00;
}
#center {
height: 100%;
width: 500px;
background-color: #00FF66;
}
#footer {
width: 500px;
background-color: #0000FF;
height: 100px;
}

-->
</style>
</head>

<body>
<div id="main">

<div id="top"></div>

<div id="center">
<p>888 </p>
<p> </p>
<p> </p>
</div>

<div id="footer"></div>

</div>
</html&