【问题标题】:Change CSS of li class when hovering over a class将鼠标悬停在类上时更改 li 类的 CSS
【发布时间】:2020-06-28 21:39:04
【问题描述】:

我想更改一个 li 类的 CSS,同时将鼠标悬停在一个类上。

我的网站是 hoomi.nl。具体页面为:https://hoomi.nl/producten/

当有人将鼠标悬停在 productimage/productbox 上方时,应该会弹出“meer informatie”按钮。现在,该按钮仅在您将鼠标悬停在产品框的中心时才会出现。我怎么能这样做?

我已经创建了自定义 css 来向上移动按钮并更改颜色以使其在您不悬停在其上时使其不可见,并且当您将鼠标悬停在其上时,背景和文本会变为颜色,因此您可以看到它。

li.product .button{
    font-weight: 300;
    font-size: 13px;
    color: #fff0;
    border-radius: 5px;
    background: #fff0;
    left: 50%;
    line-height: 1em;
    margin: 0;
    margin-left: -6em;
    margin-top: -2.5em;
    position: absolute;
    top: 50%;
    transition: opacity .4s cubic-bezier(.5,.25,0,1);
    width: 12em;
}

    li.product .button:hover {
    background-color: #fff;
    color: #333;
}

【问题讨论】:

标签: html css wordpress woocommerce


【解决方案1】:

您是否尝试在 <li> 上使用 :hover CSS,如下所示:

li.product:hover .button {
    background-color: #fff;
    color: #333;
}

【讨论】:

    【解决方案2】:

    请在您的 css 文件中添加以下 CSS:

    .elementor-widget-woocommerce-products.elementor-wc-products ul.products li.product:hover .button {
        display: block;
    }
    .elementor-widget-woocommerce-products.elementor-wc-products ul.products li.product .button {
        display: none;
    }

    【讨论】:

      猜你喜欢
      • 2011-11-07
      • 1970-01-01
      • 2023-03-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-30
      • 2015-03-31
      • 2013-07-10
      相关资源
      最近更新 更多