asp.net - 使用 CSS 在 IE6 中滚动 DIV

标签 asp.net css internet-explorer-6

我一直在用 ASP.NET 编写一个小型布告栏站点,但我所做的任何事情都无法使其在 IE6 中正常运行。主页有一个标题 DIV,其下方是内容区域。在该区域中还有另外三个区域,左上角的搜索工具,其下方的通知列表,以及这两个区域右侧的当前显示的通知。搜索和通知列表区域的宽度为 240px,显示的通知区域占据了剩余的宽度。问题在于,如果内容大于显示区域(即 overflow:auto 样式),通知列表和显示的通知区域都应该滚动,但这在 IE6 中不会发生。其他一切都显示正常。布局如下:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"  "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  <head runat="server">
    <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
    <title>Notice Board</title>
    <style type="text/css">
      body
      {
        margin:0;
        border:0;
        padding:0;
        height:100%;
        max-height: 100%;
        overflow: hidden; 
      }

      #header
      {
        position:absolute; 
        top:0; 
        left:0; 
        width:100%; 
        height:130px; 
        overflow:hidden; 
      }

      #footer
      {
        position:absolute; 
        bottom:0; 
        left:0;
        width:100%; 
        height:0px; 
        overflow:hidden; 
      }

      #content
      {
        position:absolute; 
        top:130px;
        left:0;
        bottom:0px; 
        right:0; 
        overflow:hidden; 
      }

      * html body
      {
        padding:130px 0 0 0; 
      }

      * html #content
      {
        height:100%; 
        width:100%; 
      }

      #leftdiv 
      {
        position:absolute;
        left:0;
        width:240px;
        top:0;
        height:100px;
        overflow:hidden;
      }

      #listdiv 
      {
        position:absolute;
        left:0;
        width:240px;
        top:100px;
        bottom:0px;
        overflow:auto;
      }

      #noticediv
      {
        position:absolute;
        left: 270px;
        right:0;
        top:0;
        bottom:0;
        overflow:auto;
      }
    </style>
  </head>
  <body>
    <form id="form1" runat="server" method="post">
      <div id="header" >
        <!-- Header content goes here -->
      </div>

      <div id="content">

        <div id="leftdiv">
          <!-- Content region for the search facility goes here -->
        </div>

        <div id="listdiv">
          <!-- Content region for the notice list goes here -->
        </div>

        <div id="noticediv" >
          <!-- Content region for the displayed notice goes here -->
        </div>
      </div>
    </form>
  </body>
</html>

有什么想法吗?

最佳答案

对于要滚动的 DIV,它必须至少指定一个高度和/或一个宽度,具体取决于您希望它滚动的维度。某些浏览器(例如 Firefox)会在给定顶部和底部值的情况下推断出高度。然而,IE6 不会。

关于asp.net - 使用 CSS 在 IE6 中滚动 DIV,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1102499/

相关文章:

javascript - 如何在 jQuery 中选择正确的元素

html - 边框不围绕 anchor 元素

css - Internet Explorer 边框错误

internet-explorer-7 - CSS Box 阴影在 IE6 和 IE7 中不起作用

css - 清除 IE6 中连续 float 实体之间的 float

c# - 使用 Entity Framework 选择 DBSet 中的行

asp.net - ASP.NET MVC 网站中的全局值是否可以由使用该网站的任何人访问,或者是否为每个 session 实例化?

asp.net - WCF 服务接收 NULL 值

asp.net - 为什么当我使用 TortoiseSVN 更新代码时 ASP.Net 会锁定

html - 如何在CSS中为文本设置特定的像素或字符宽度限制