DIV+CSS高度自适应问题(firefox里出错)

来源:百度知道 编辑:UC知道 时间:2024/05/15 19:32:23
css里面:
.nrtp{
width:680px;
height:auto;
overflow:hidden;
top:0;
left:0;
margin-top: 5px;
margin-left: 10px;
text-align: center;
}

页面:
<div class="nrtp">图片</div>

问:为什么页面里面的div不能根据图片的高度自动适应呢?
在IE里面就可以,但是在firefox里面就出错,我应该怎么修改?

<!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=gb2312" />
<title>解决ie6 7 8 ff chrome div高度自动增加问题 by saruri </title>
</head>

<body style="padding:0px; margin:0px; min-height:300px;">
<style>
.abc{ width:940px; min-height:60px;
max-height:none; border:1px solid #999; background-color:#060;}
.cde{width:940px;
max-height:none; border:1px solid #999; background-color:#060;}
.fgh{width:940px;
height:60px; max-height:none; bor