怎么让Div自适应width和height,div下有一个img(width,height不定)!

yuzhixun2008 2010-05-03 05:06:04
<!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>无标题文档</title>
<style type="text/css">
*{padding:0;margin:0;}
body{margin:10px;}
img{border:none;}
#big-pic{
width:auto;
height:auto;
border:1px solid #CAC292;
background:#CAC292;
}
#big-pic #drag_dialog{
background:url(images/user-bg-01.gif) repeat-x;
height:28px;
line-height:28px;
text-align:left;
color:#0000FF;
padding:0 0 0 10px;
font-size:14px;
cursor:move;
}
#big-pic #drag_dialog #close-div{
display:block;
width:18px;
height:17px;
margin:5px;
cursor:pointer;
text-indent:-9999px;
background:url("images/dialogclose.gif") no-repeat;
float:right;
}
#big-pic div{
margin:3px;
}
#big-pic div img{
display:block;
background:#FFF;
}
</style>
</head>

<body>
<div id="big-pic">
<div>
<h1 id="drag_dialog">查看图片<em id="close-div">关闭</em></h1>
<img src="aa.jpg" />
</div>
</div>
</body>
</html>
...全文
150 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
zjtpiaoxue 2010-05-03
  • 打赏
  • 举报
回复
ie 下是可以自适应的,只要将width:auto;height:auto即可;
火狐下却不行,将div 的display值设为table
yuzhixun2008 2010-05-03
  • 打赏
  • 举报
回复
求各位大虾帮忙!!!!!!!!!!!

61,112

社区成员

发帖
与我相关
我的任务
社区描述
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。
社区管理员
  • HTML(CSS)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧