gpt4 book ai didi

html - 在悬停之前或之后颜色不起作用

转载 作者:行者123 更新时间:2023-11-28 04:07:55 26 4
gpt4 key购买 nike

当我尝试在我的价格表部分中悬停(悬停之前使用之前)时,背景发生了变化,但颜色不起作用。

这是我的标记

<div class="col-lg-4 col-md-4- col-sm-4 col-xs-12">
<div class="single-price-table price-tbl-active">
<div class="price-header">
<h3>Startup</h3>
</div>
<div class="price-content pptb-30">
<h4> <sub> $ </sub> 279 </h4>
<span>/month</span>
<ul>
<li>20 Users</li>
<li>Unlimited Plan</li>
<li>Custom Design</li>
<li>Lorem Ipsum</li>
<li>Unlimited Time</li>
</ul>
</div>
<div class="price-footer">
<a href="">Get Started Now</a>
</div>
</div>
</div>

这是我的样式表代码:

.single-price-table{
position:relative;
}
.single-price-table:first-child::before {
background: #283754 none repeat scroll 0 0;
content: "";
height: 10%;
left: 0;
position: absolute;
width: 100%;
opacity: 0;
color:#ffffff;
}
.single-price-table:hover:first-child::before{
opacity: 1;
}
.single-price-table:last-child::after {
background: #283754 none repeat scroll 0 0;
content: "";
height: 10%;
left: 0;
position: absolute;
width: 100%;
opacity: 0;
color:#ffffff;
}
.single-price-table:hover:last-child::after{
opacity: 1;

}

最佳答案

使用

.single-price-table:first-child:hover::before {

不是

.single-price-table:hover:first-child::before {

首先找到选择器然后应用悬停

.single-price-table {
position: relative;
}

.single-price-table:first-child::before {
background: #283754 none repeat scroll 0 0;
content: "";
height: 10%;
left: 0;
position: absolute;
width: 100%;
opacity: 0;
color: #ffffff;
}

.single-price-table:first-child:hover::before {
opacity: 1;
}

.single-price-table:last-child::after {
background: #283754 none repeat scroll 0 0;
content: "";
height: 10%;
left: 0;
position: absolute;
width: 100%;
opacity: 0;
color: #ffffff;
}

.single-price-table:last-child:hover::after {
opacity: 1;
}
<div class="col-lg-4 col-md-4- col-sm-4 col-xs-12">
<div class="single-price-table price-tbl-active">
<div class="price-header">
<h3>Startup</h3>
</div>
<div class="price-content pptb-30">
<h4> <sub> $ </sub> 279 </h4>
<span>/month</span>
<ul>
<li>20 Users</li>
<li>Unlimited Plan</li>
<li>Custom Design</li>
<li>Lorem Ipsum</li>
<li>Unlimited Time</li>
</ul>
</div>
<div class="price-footer">
<a href="">Get Started Now</a>
</div>
</div>
</div>

关于html - 在悬停之前或之后颜色不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42873891/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com