我想在容器悬停时在元素上制作简单的动画。我不知道应该用CSS语法编写它。
<article class="col-md-4 offer-box">
<div class="media">
<div class="media-left">
<i id="icon" class="fa fa-paint-brush"></i>
</div>
<div class="media-body">
<h4 class="media-heading" id="text-light">Web Design</h4>
<p class="text-muted">Pellentesque habitant
morbi tristique senectus et netus et
malesuada fames ac turpis egestas.
Vestibulum tortor quam, feugiat vitae,
ultricies eget, tempor sit amet, ante.
Donec eu libero sit amet quam egestas
semper. Aenean ultricies mi vitae est.
Mauris placerat eleifend leo.</p>
</div>
</div>
</article>
#icon{
color: #ef5925;
font-size: 35px;
transition-duration: 1s;
}
.offer-box:hover{
#icon{
color: #fff;
font-size: 40px;
}
}
答案 0 :(得分:1)
您的css语法错误。写得像这样:
.offer-box:hover #icon{
color: #fff;
font-size: 40px;
}