一个div内嵌套很多div,div里面嵌套table显示数据当在不同大小的屏幕浏览时,div自动伸缩,高度自动调整,里面的内容自动调整。做过的麻烦指点一下。

解决方案 »

  1.   

    - -
    <div style="width:100%;height:100%"></div>
      

  2.   

    全部用百分比很难控制,div用百分比,里面的td宽高也用百分比?
      

  3.   


     <div id="center-out" >
                       <div id="center-top" > <div class="fon">中间</div> </div> 
                       <div id="center-content" > 
                       <iframe frameborder="0" id="main" name="main" src="main.aspx" scrolling="no"  marginheight="0" marginwidth="0" style=" width:620px; height: 300px; margin:2px">
                   </iframe>
                        </div>
    #center-out{ position:relative;margin-right:1px;float:left;margin-top:10px;left:1px; width:63%;}
    #center-top{  position:relative;width:128.5%; height:20px;border:0px solid green; line-height:18px; background-color:Orange;float:left;}
    #center-content{position:relative; height:300px; width:63%;border-left:1px solid Orange ;border-right:1px solid Orange;  border-bottom:1px solid Orange;  background-image: url(img/bg.jpg);}为什么我center-top的设置成width:128.5%才与center-content的width:63%相等?width是相对哪一个的?
      

  4.   

    div的宽度如果你不去指定的话,他默认是父容器所能显示的100%宽高度,真的是没办法百分比 失效..
      

  5.   

    用auto   IE7里边就是这个样子的
      

  6.   

    呵呵 在div里面最好不要去定义网页的高度 
      

  7.   

    <!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">
    <!--
    body { font-family:Arial, Helvetica, sans-serif; font-size:12px; margin:0px; padding:0px; color:#666;}
    .center { width:96%; margin:0; padding:10px 1%; border:1px solid #ccc; margin:100px auto 10px;}
    .center table { width:100%; border:0px;}
    -->
    </style>
    </head><body>
    <div class="center">
      <table>
        <tr>
          <td>不得不知的java规范与标准 * 众多Java培训大师全套Javaee视频下载 * 构建出色多核应用程序 世界500强企业面试技巧题 IBM dW精华技,开发者必看
    快速变身java/.net达人秘籍 财富两千强公司都选甲骨文SOA解决方案 IT工程师的技术不得不知的java规范与标准 * 众多Java培训大师全套Javaee视频下载 * 构建出色多核应用程序 世界500强企业面试技巧题 IBM dW精华技,开发者必看
    快速变身java/.net达人秘籍 财富两千强公司都选甲骨文SOA解决方案 IT工程师的技术互“动”社区
    不得不知的java规范与标准 * 众多Java培训大师全套Javaee视频下载 * 构建出色多核应用程序 世界500强企业面试技巧题 IBM dW精华技,开发者必看
    快速变身java/.net达人秘籍 财富两千强公司都选甲骨文SOA解决方案 IT工程师的技术互“动”社区
    互“动”社区</td>
        </tr>
      </table>
    </div>
    </body>
    </html>看看你要是不是这种效果