0

我一直在尝试在外部 div 的顶部修复内部 div。
1.inner div 应该比outer div 有更宽的宽度
2.outer div 是可滚动的,inner div 应该在滚动时保持在outer div 的顶部。

我的问题是内部 div 更长时间停留在外部 div 内。


<div id="ScheduleHolder" style="height:100px; width:120px; overflow:scroll">

    <div id="2" valign="top" style="float:none; display:block; position:absolute !important; margin:0;">

        <table border="1" bgcolor="#99FF00">

          <tr>

            <th scope="col">&nbsp;</th>

            <th scope="col">&nbsp;</th>

            <th scope="col">&nbsp;</th>

            <th scope="col">&nbsp;</th>

            <th scope="col">&nbsp;</th>

            <th scope="col">&nbsp;</th>

            <th scope="col">&nbsp;</th>

            <th scope="col">&nbsp;</th>

            <th scope="col">&nbsp;</th>

            <th scope="col">&nbsp;</th>

            <th scope="col">&nbsp;</th>

            <th scope="col">&nbsp;</th>

            <th scope="col">&nbsp;</th>



          </tr>

        </table> 

    </div>



    <div id="3" style="float:left; display:block;">

       <table border="1">

          <tr>

            <th scope="col">&nbsp;</th>

            <th scope="col">&nbsp;</th>

            <th scope="col">&nbsp;</th>

            <th scope="col">&nbsp;</th>

            <th scope="col">&nbsp;</th>

            <th scope="col">&nbsp;</th>

            <th scope="col">&nbsp;</th>

            <th scope="col">&nbsp;</th>

            <th scope="col">&nbsp;</th>

            <th scope="col">&nbsp;</th>

            <th scope="col">&nbsp;</th>

            <th scope="col">&nbsp;</th>

            <th scope="col">&nbsp;</th>



          </tr>

          <tr>

            <th scope="row">&nbsp;</th>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

                            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

          </tr>

          <tr>

            <th scope="row">&nbsp;</th>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

                            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

          </tr>

          <tr>

            <th scope="row">&nbsp;</th>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

                            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

          </tr>

          <tr>

            <th scope="row">&nbsp;</th>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

                            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

          </tr>

          <tr>

            <th scope="row">&nbsp;</th>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

                            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

          </tr>

          <tr>

            <th scope="row">&nbsp;</th>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

                            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

          </tr>

          <tr>

            <th scope="row">&nbsp;</th>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

                            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

          </tr>

          <tr>

            <th scope="row">&nbsp;</th>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

                            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

          </tr>

          <tr>

            <th scope="row">&nbsp;</th>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

                            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

          </tr>

          <tr>

            <th scope="row">&nbsp;</th>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

            <td>&nbsp;</td>

          </tr>

        </table>



    </div>

    <div style="clear:both"></div>

</div>
4

2 回答 2

0

你想试试 DataTables jQuery 插件来处理这个问题: http ://datatables.net/

于 2012-04-23T06:32:04.897 回答
0

好吧,只需将内部 div 放在外部 div 之外,然后将现在是外部 div 的内部 div 与外部 div 对齐,当然,现在内部 div 和您的内部 div 将出现在旧内部 div 的顶部,但是我们知道这是秘密的外部div。

于 2012-04-23T03:43:23.970 回答