CSS   发布时间:2022-04-17  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了css – 固定div,动态内容不滚动大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个固定的div与动态加载的li元素.现在我希望div-content在有超过9个li元素和滚动条时滚动:

这就是它的样子:

此时固定div继续在页脚上,内容无法滚动.

这是所有div的css:

#fixed-div {
    position: fixed;
    width: 30%;
    margin-top:290px;
    padding-top:20px;
    padding-bottom: 20px; /* must be same height as the footer */
    BACkground-color: rgba(255,255,0.60);
    min-height: 100%;
}

#absolute-div {
  padding: 15px;
  BACkground-color: rgba(255,0.60);
  margin-bottom: 10px;
  position: relative;
  height: 200px;
}
#footer {
    position: relative;
    margin-top: -33px; /* negative value of footer height */
    height: 20px;
    line-height: 33px;
    border-bottom:20px solid #fff;
    text-align: left;
    BACkground-color:#fff;
    padding-left:10px;
}
#map_canvas { /* BACkground */
  clear:left;
  float: left;
  width: 100%;
  min-height: 100%;
  z-index:-1001;
 /* height: 530px;*/
  -webkit-box-shadow: 0px 0px 10px #888;
  -moz-box-shadow: 0px 0px 10px #888;
}

这是HTML:

<body>

                <div id="searchbox">  

                <div id="absolute-div" class="clear-block">


                        <form method="post" action="./index.php" accept-charset="UTF-8" method="post" id="clinic-finder-form" class="clear-block" class="clear-block">


                             <label for="edit-gmap-address">Standort angeben und Vorteile in der Umgebung finden: </label>
                             <input type="text" maxlength="128" name="address" id="address" size="60" value="" class="form-text" autocomplete="off" />
                <?php 
                            // support unicode
                            mysql_query("SET NAMES utf8");
                            $cats = $db->get_rows("SELECT categories.* FROM categories WHERE categories.id!='' ORDER BY categories.cat_name ASC");

                            ?>


                             <SELEct name="products" class="form-SELEct" id="edit-products" ><option value="">Alle Kategorien</option>
                             <?php if(!empty($cats)): ?>
                                <?php foreach($cats as $k=>$v): ?>
                                <option value="<?php echo $v['id']; ?>"><?php echo $v['cat_name']; ?></option>
                                <?php endforeach; ?>
                                <?php endif; ?>
                             </SELEct>


                            <input type="submit" name="op" id="edit-submit" value="Vorteile finden" class="btn btn-priMary" />
                            <input type="hidden" name="form_build_id" id="form-0168068fce35cf80f346d6c1dbd7344e" value="form-0168068fce35cf80f346d6c1dbd7344e"  />
                            <input type="hidden" name="form_id" id="edit-clinic-finder-form" value="clinic_finder_form"  />

                            <input type="button" name="op" onclick="document.LOCATIOn.href='newstore.php'" id="edit-submit" value="Unternehmen vorschlagen" class="btn btn-priMary" />


                            </form>

</div></div>
        <div id="fixed-div">
                      <div id="clinic-finder" class="clear-block">
                      <div id="results">        


                        <ol style="display: block; " id="list"></ol>
                      </div>
                      </div>

        </div>

    <div id="map_canvas"></div>
    <div id="footer">&copy; 2008-2013 Ihr Vorteilsclub - Impressum</div>

非常感谢!马塞尔

解决方法

将此添加到您的CSS:
#results {        
    height: 100%; 
    overflow-y: scroll; /* adds scrollbar */
}

大佬总结

以上是大佬教程为你收集整理的css – 固定div,动态内容不滚动全部内容,希望文章能够帮你解决css – 固定div,动态内容不滚动所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。