css - 使 div 的内容可滚动

标签 css wordpress position overflow scrollable

我正在使用 wordpress 和 woocommerce 来创建 eshop。 Woocommerce 有一个名为 mini-cart.php 的部分,它是客户的实际购物车。但是我需要这个购物车最多占整个网站高度的 60%,并且我需要购物车的内容可以滚动。这很容易,但我需要做的第二件事是从滚动中排除按钮和总数。我尝试了很多方法,但它从来没有奏效。这是我使用的代码:

<div class="cart active">
  <div class="cart-wrapper">
    <h1 class="widget-title"> </h1><div class="widget_shopping_cart_content"><div class="cart-product-list">
    <ul class="cart_list product_list_widget ">
      <li><a href="http://autoflex.zone42.sk/obchod/2x-stabilizator-predna-naprava-porsche-911-od-09-1997/">
          <img src="http://autoflex.zone42.sk/wp-content/uploads/2013/10/2x-stabilizátor-predná-náprava-Porsche-Boxster-od-09.1996-90x90.jpg" class="attachment-shop_thumbnail wp-post-image" alt="2x stabilizátor predná náprava Porsche 911 od: 09.1997" height="90" width="90">
                    2x stabilizátor predná náprava Porsche 911 od: 09.1997
          </a>
          <p class="quantity">1 × <span class="amount">50,90€</span></p>
     </li>
  </ul>
</div><!-- end product list -->    
<p class="total"><strong>Medzisúčet:</strong> <span class="amount">50,90€</span></p>  
    <div class="buttons">
        <a href="http://autoflex.zone42.sk/kosik/" class="button">
            <div class="cart-buttons">
                <div class="cart-buttons-padding">
                    Zobraziť košík →                </div>
            </div>
        </a>
        <a href="http://autoflex.zone42.sk/pokladna/" class="button checkout">
            <div class="cart-buttons">
                <div class="cart-buttons-padding">
                  pokladňa →                </div>
            </div>
        </a>
    </div>


</div>                

这是 CSS:

.cart.active{
    max-height: 60%;
    margin-bottom: -25px;

    transition: max-height .5s .2s;
    -ms-transition: max-height .5s .2s;
    -moz-transition: max-height .5s .2s;
    -webkit-transition: max-height .5s .2s;
}
div.facebook:hover, div.mail-us:hover, div.move-up:hover, div.cart-total.hoverOn:hover{
    right: 150px;
}
div.cart-total.hoverOn{
    transition: all .5s, width .5s .5s;
}
div.cart-total.hoverOff{
    transition: all .5s, width .2s;
    right: 150px;
    width: 279px;
}
.cart-product-list{
    overflow-y: auto;
}

那么如果我只想要 ul (cart_list) 可滚动怎么办?而且我还希望整个 div 名称购物车处于事件状态,最高为整个网站的 60% 高度?感谢转发

最佳答案

ul.cart_list {
 overflow: scroll;
}

关于css - 使 div 的内容可滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19343942/

相关文章:

javascript - 直线对齐

html - 无法将我的列表项置于中心

css - Font Awesome 图标是否适用于 Google App Engine 环境?

jQuery 获取元素相对位置

css - 具有绝对位置的页脚 - 响应式设计

所有浏览器上的位置和溢出的 CSS 错误

html - 菜鸟 div 标签问题 - 自动调整大小和定位

HTML/CSS 从使用 CSS 加载到 SPAN 中的图像中删除边框(或轮廓)

wordpress - WooCommerce - 获取购物车中不同产品的数量

html - 从无 cookie 域提供静态内容